Jump to content

This topic is 8389 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I've searched this forum for a Month calculation but I don't see one that addresses my specific need. I have an employee database with a "startdate" field and I need a calculation for the number of Months each person has worked. I have a year calculation that works fine...

Year[Today] - Year[startdate] - If[Today< Date[Month[startdate], Day[startdate], Year[Today]], 1, 0]

...but I can't figure out how to break it down to months. I don't care about +/-30 day increments, just months. So if someone started on the 31st of a month, that could be included as one month.

Posted

First thing: don't use TODAY use the Status(CurrentDate) function.

Second: work out the algorithm to calculate months.

first determine the number of whole years: it's Year (Finish) - Year (Start).

Then work out the number of months based on the Months of the dates...

Month (Finish) - Month (Start)

This will be negative if the finish month is earlier in the year than the start month, which is exactly what we want.

So we end up with...

((Year (Finish) - Year (Start)) * 12) + Month (Finish) - Month (Start))

I just tried it and it seems to work, but sheck it yourself thoroughly before using it live.

Substitute the Status(CurrentDate) function for Finish if you want the calculation to be fromthe current date, rather than a finish date.

This topic is 8389 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.