• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Please help. How do I round to the nearest month?

zeeworld

New Member
Hello,

I need the cell to round to the nearest month. I have attached the file. Any help is appreciated. Thanks
 

Attachments

  • test.xlsx
    9.7 KB · Views: 8
I do not agree with your example. The dates are little more than a month apart.

Code:
= LET(
  months, DATEDIF(JoiningDate, LeavingDate, "m" ),
  days,   DATEDIF(JoiningDate, LeavingDate, "md"),
  ROUND(months + days/30, 0) )


= ROUND(DATEDIF(JoiningDate, LeavingDate, "m") + DATEDIF(JoiningDate, LeavingDate, "md")/30, 0)

The concept of rounding is months is not precisely defined, given that 15days may be more or less than half a month, depending on the length of the month. The first formula using the LET function explains the calculation, but the second works without requiring MS365.
 

Attachments

  • monthsRounded.xlsx
    10.3 KB · Views: 8
Back
Top