+ Start a Discussion
Glenn Nyhan 54Glenn Nyhan 54 

Subtracting Start Date from End Date results in negative number

Hi All,

I created a formula field where I'm subtracting the Start Date the End Date of a record, but the value that gets returned is a negative number i.e. -26. How can I fix the formula to show a non negative number? Thanks in advance for any help?

Warmly,
Glenn
Best Answer chosen by Glenn Nyhan 54
Alain CabonAlain Cabon
ABS ( Time_In_Service_End_Date__c  - Time_In_Service_Start_Date__c  ) = the result is a number.

If Time_In_Service_End_Date__c  < Time_In_Service_Start_Date__c , it is not logical by the way.

All Answers

Alain CabonAlain Cabon
Did you try ABS?

ABS Description:Calculates the absolute value of a number. The absolute value of a number is the number without its positive or negative sign.

Example:ABS(ExpectedRevenue) calculates the positive value of the Expected Revenue amount regardless of whether it is positive or negative.
Glenn Nyhan 54Glenn Nyhan 54
Hi Alain,

My current formula looks like this:

API Name Accrued_Days__c

( Time_In_Service_End_Date__c ) - Time_In_Service_Start_Date__c 

This is returning a negative value. Can you tell me how I add the ABS () portion to the formula? Thanks for the help. 
Alain CabonAlain Cabon
ABS ( Time_In_Service_End_Date__c  - Time_In_Service_Start_Date__c  ) = the result is a number.

If Time_In_Service_End_Date__c  < Time_In_Service_Start_Date__c , it is not logical by the way.
This was selected as the best answer
Glenn Nyhan 54Glenn Nyhan 54
Thanks Alain, this worked.