function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manishamanisha 

Formual Help

I am trying to write a formula In my account page I have a field for # of years in Business. This number needs to change every year. Once my users put this number in once. I would like this number to change each year. To solve this problem I am asking my users to put in the year the business started and then I created a read only field for current year. Then I created a formual field that would calculate the number of year "Current Year - Year the business started" this would give me a number. but its not giving me this error Error: Incorrect parameter for operator '-'. Expected Number, Date, DateTime, received Text when I try to put the formual. Can you please help or have anyother ideas? Thank you, Manisha

Best Answer chosen by Admin (Salesforce Developers) 
Starz26Starz26

Have them put in the date as you already do, creat a formula field of type number.

 

Then in the formula try:

 

Year(Today()) - YEAR( DATE_FIELD_FOR_USER_INPUT)

All Answers

Starz26Starz26

Have them put in the date as you already do, creat a formula field of type number.

 

Then in the formula try:

 

Year(Today()) - YEAR( DATE_FIELD_FOR_USER_INPUT)

This was selected as the best answer
manishamanisha

Thanks for this. This worked.