Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Andreas Gerogiannis

# Can you help me figure out how to calculate the age of a business?

What's up

Is there a way to use the TODAY or YEAR (or some other one) functions to take a static number in a field and calculate an amount of time?

What I'm getting at is, if a company submits a lead today and tells us they've been in business for 10 years, is there a way to write a formula that will say 11 years next year, 12 years two years from now, etc?  I'm a brand new admin so my developing skills are pretty much non-existent.  You guys are geniuses as far as I'm concerned.

I love you.

Sonam_SFDC

Hi Jeremy,

What you can do is - create one field that will save the date the business was established:

for  e.g. Date Established(date type)

Create another field " years in business" which is a formula field which can calculate the difference between date established and today's date:

Use the following Formula for the field to calculate the difference between the two dates:

(YEAR(TODAY()) *12+MONTH(TODAY()) +((IF(MONTH(TODAY()) = MONTH( date_established__c ), 0, 1)) - (YEAR(date_established__c) * 12 + MONTH(date_established__c))))/12

Each time you view the record - years established will be recalculated and you will see the updated number of years in business.

Hope this helps!

Sonam_SFDC

Hi Jeremy,

What you can do is - create one field that will save the date the business was established:

for  e.g. Date Established(date type)

Create another field " years in business" which is a formula field which can calculate the difference between date established and today's date:

Use the following Formula for the field to calculate the difference between the two dates:

(YEAR(TODAY()) *12+MONTH(TODAY()) +((IF(MONTH(TODAY()) = MONTH( date_established__c ), 0, 1)) - (YEAR(date_established__c) * 12 + MONTH(date_established__c))))/12

Each time you view the record - years established will be recalculated and you will see the updated number of years in business.

Hope this helps!

This was selected as the best answer
Andreas Gerogiannis

Sonam-

Thank you so much!  When I paste in your code and check the syntax, I get this error:

Incorrect parameter type for function 'MONTH()'. Expected Date, received Number

Any idea what to do about that?

Thank you!!

Jeremy

Sonam_SFDC

Hey Jeremy,

Could you please check the return of the formula field to make sure it is number and not date.

The days in business will return a number so make sure the return type is set to number.

let me know..

Andreas Gerogiannis
yes, it is set to number
Sonam_SFDC

Hi Jeremy,

Could you please message me your ORG ID together with support login access(http://login.salesforce.com/help/doc/en/granting_login_access.htm) and name of Object and field that you have created so I can troubleshoot this issue further.