Hi Shauna,
If I understand correctly you have a {StartDate}, {DealAmount} and {DurationInMonths} column.
Let’s say you create {January}, {February},…{December} formula columns.
You’d want to set up different formulas for each column. Let’s see what it would be for February 2024. Here is the logic I would apply. I’d see if the same day in February than the day of the start date is between the start date and end date of the deal. In other words, if the deal starts Jan 12 I want to know if Feb 12 is within the deal date ranges. If the deal starts Jan 12 and lasts 6 months, the answer is yes. If the deal starts March 20 and lasts 6 months, the answer is no. If the answer is yes, I want the formula column to display {DealAmount}/{DurationInMonths}. If the answer is no, I want to display nothing.
To calculate the date to check, use
FORMAT_DATE(DATE(2024,2,DAY({StartDate})),"YYYY-MM-DD")
Note the 2024,2 in the middle, it stands for February 2024.
We need to compare this date with {StartDate} (>=) and with the end of the deal which is calculated using the EDATE function which allows you to add months to a date, like this: FORMAT_DATE(EDATE({StartDate}, {DurationInMonths},“YYYY-MM-DD”))
So the formula to determine if the date is within the deal or not is:
IF(AND(
FORMAT_DATE(DATE(2024,2,DAY({StartDate})),"YYYY-MM-DD")>={StartDate},
FORMAT_DATE(DATE(2024,2,DAY({StartDate})),"YYYY-MM-DD")
<FORMAT_DATE(EDATE({StartDate},{DurationInMonths},"YYYY-MM-DD"))
),"WITHIN DEAL","NOT WITHIN DEAL")
With the final values, we get:
IF(AND(
FORMAT_DATE(DATE(2024,2,DAY({StartDate})),"YYYY-MM-DD")>={StartDate},
FORMAT_DATE(DATE(2024,2,DAY({StartDate})),"YYYY-MM-DD")
<FORMAT_DATE(EDATE({StartDate},{DurationInMonths},"YYYY-MM-DD"))
),{DealAmount}/{DurationInMonths},"")
You’ll need to adjust the reference to the month twice in the formula for each new formula column.
Want to get rid of the formula column? and write formulas that support multiple lines, variables and can update various columns at once? Take a look at the Advanced Formula Booster at https://mdboosters.com*