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
Harmpie

# Calculation of a date using formula field

Is something like this possible using a formula field? I want to add a numberfield (number of months in 'Estimated_Time_For_Exection__c') to a start date, to calculate the end date.

The formula below gives an error:

Code:
`DATE(YEAR(Start_Date__c),MONTH(Start_Date__c)+ Estimated_Time_For_Exection__c ,DAY(Start_Date__c))`

RickyG
When I attempted to replicate this formula, it compiled, but did not produce the proper results.  You can get there much easier by simply adding an integer which represents the number of days to the Date field.  You would have to calculate this based on the starting month, but everything will work fine after you get that set up.

Hope this helps.
Harmpie
Yes, it compiles but turns out a #error on the page.

I am not sure what you're saying in your solution by using an integer field. Could you explain this further?

What I got is 2 fields:
- Start date
- Project duration in months

These 2 should allow the end date to be calculated.
RickyG
date + (Project_Duration_In_Months * 30), plus some intermediate number calculated by a formula to determine how much adjustment for the differing number of days in a month.
Harmpie
Thx Ricky. Got the point now, used number of months*30.3 now :) Quite accurate

Message Edited by Harmpie on 11-13-2008 06:26 AM