I have two fields both of type Datetime, I need another field(Formula field) which will show the greatest timestamp of these two fields.

I tried to use Max function, max( Approved_By_Manager_Date__c,Date_Paperwork_sent__c)

and I get syntax error


MAX only works on number-types (such as numbers, currency, and so on). Dates are not ordinarily number types, although you could convert them that way if you wanted to. Normally, you'd just use a normal IF statement:

| improve this answer | |

MAX() only evaluates integers. IF statements are easiest with 2 date fields, but as the number of fields referenced increases, it becomes exceedingly difficult to manage.

To use MAX() or MIN(), you must convert dates to an integer first. Then, use your returned value to subtract from the current date (Today). Top get the most recent date of a list, you'll need to use the MIN() function. To get the earliest date, you'll need to use the MAX() function.

TODAY() - 

MIN(TODAY()- End_Date__c, TODAY() - Start_Date__c )

Essentially, this formula will provide the date which is closest to today (latest date). Note, this only works if all of your date fields do not reference a future date.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.