I have a project management app I’m working on and each project has several phases. These phases have a start and end date (not a date range) and a fee associated with them. I’m trying to create a projection report by month that would take the start month and end month and divide up the fee evenly between the start month, end month, and months in between. I’m at a loss to figure out how to calculate the number of months to divide the fee by. I can extract the month from the start and end date, then subtract them, but if the phase spans multiple years, it won’t take that into account. I also thought about formating as “yymm” and subtracting them, but again, I would get a weird result because 2101-2012 doesn’t equal one. Any ideas on how to calulate the duration in months?

you could try calculating the difference in years x 12, then adding the difference in months.

So an 8 month project from Oct 2020 to May 2021, would be 05/2021 - 10/2020

Calculation #1: 2021-2020 = 1 x 12 = 12

Calculation #2: 5 - 10 = -5

Calculation #3: 12 + (-5) + 1 = 8

(must always add the +1 to account for the starting month. i.e. a one month project would be zero before adding the 1)

This topic was automatically closed after 70 days. New replies are no longer allowed.