Create a formula duration over 5 years
Hello, I am trying to figure this out
How to calculate a duration for each year based on a varying start date?
The start date can be at any month of the year (just calculating months, not days) and the project will last over the next 5 years.
Example: IF the Start date is September 2024, there's 4 full months for the first year. And if they're needed for ([Months Needed] is for 12 or 18 or 60 months, then how would I find the duration of the next year, and the next?
Would each year need it's own duration field? Like Year 1 duration, Year 2 duration, etc?
I'll have these fields
[YEAR 1], [YEAR 2], [YEAR 3], [YEAR 4], [YEAR 5].
[Start Date]
[Months Needed]
Thank you! I ended up joining a Quickbase Office Hours with Sam, and we discussed this option:
1st year:var date SD=[Start Date];
var date ED=LastDayOfYear([Start Date]);
(Year($ED)-Year($SD))/12 // start off with 12 months
+If(Month($ED)>=Month($SD),0) //add 12 months if the last year was fully completed+ If((Month($ED)>=Month($SD)),Month($ED)-Month($SD),12+Month($ED)-Month($SD)) // add the number of months between the month numbers.
//-If(Day($ED)<Day($SD),0,0) // but if the day did not catch up to the start date's day number, then subtract 1.
2nd Year:var number secondyear=[Months Needed]-[First Year Duration];
If($secondyear>12,12,$secondyear)
and then repeat the pattern for 3, 4, 5 years. Then My calculation fields are working independently of any variables mashed into one field.
*(Posted to help anyone else!)
Thanks!!