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
NewCoderBoy

# need help with a formula field

Hello Everyone,
I need to create a formula field off of the Created by Date.  I'm looking to create a field that will calculate the following:
2 weeks after created date
30 days after created date
60 days after created date
90 days after created date

I have looked over documents but still hard to understand.  if you could EXPLAIN to me how i create and the syntax format that would be greatly appreciated.

fundooMental
If you just want to check few days after created date, like 2 weeks after created date and not bothered about time then you can do below:

1. Get the date value for CreatedDate. This would remove the time. So just use DATEVALUE(CreatedDate)
2. Add the number of days to it

So finall your formula would be
2 weeks after created date --  DATEVALUE(CreatedDate) + 14
30 days after created date  --  DATEVALUE(CreatedDate) + 30
60 days after created date   -- DATEVALUE(CreatedDate) + 60
90 days after created date     --  DATEVALUE(CreatedDate) + 90

NewCoderBoy
thank you.  so  i assume I do not need an if statement.  I could type the formula just as indicated??

NewCoderBoy
i would like the text to show for each of those parameters.   for example, if it has been 30 days, in my reports i would like a indicator next to "30 days after created date"   I hope that makes sense.

Andrew Wheeler
Maybe you could do it this way..

Create a formula field with a return type of 'Number' and 'Decimal Places' set to '0'. With the formula being 'NOW() - CreatedDate'. This would then give you a count of the days between the two date values.

From here you could either create another formula field that takes the number of days value and sets it to some value that identifies which section the result falls into... Maybe you could use a CASE statement or some IF statements to do that.

Or do the checking in the report somewhere...

Just an option... up to you..
fundooMental
I thought you just wanted to know how to diplay "created date + some days after created" . Since you have many dates here you need to use the If condition or Case condition. And as rightly menioned by Andrew, first you need to find out how many days has elasped and that you can find out by 'NOW() - CreatedDate' and based on this value you can formulate your If conditions or Case conditions.
fundooMental
Issue solved?