February 13, 200223 yr Newbies 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.
February 13, 200223 yr 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.
Create an account or sign in to comment