SOLVED

Add months in date

Brass Contributor

I want to add either integral or decimal number of months in date. For that, I have added formula in attached sheet. But the problem is that it calculates exact number of days and not the nearest end date. For example, the formula arrives as 30th Jan 2023 instead of 31st Jan 2023 in cell F8 of attached sheet.

 

Appreciate any help on this.

5 Replies

@Dharmendra_Bharwad 

Try

 

=EDATE(F6,E8)+ROUNDUP((EDATE(F6,E8+1)-EDATE(F6,E8))*MOD(E8,1),0)

Thanks @Hans Vogelaar 

 

This formula works now except for the month of February. Can you please adjust if for Feb as well?

Dharmendra_Bharwad_1-1665651187790.png

 

@Dharmendra_Bharwad 

3 months after 15-11-2022 is 15-02-2023.

Th month of February has 28 days. 0.5 month = 14 days.

14 days after 15-02-2023 is 01-03-2023.

 

What would you like the result to be instead, and why?

@Hans Vogelaar 

 

I have attached the excel sheet that illustrates what the issue is. Let me know if it still not cleared.

best response confirmed by Dharmendra_Bharwad (Brass Contributor)
Solution

@Dharmendra_Bharwad 

Why is the first date the first of the month and all the others the last day of the month?

If you want to round up, why do you want the result for the first date to be the 15th instead of the 16th?

The middle of January is the 16th, not the 15th.

See attached workbook with first date changed to 31-12-2022 for consistency, and a new formula that will work if the dates are all the last day of the month.

1 best response

Accepted Solutions
best response confirmed by Dharmendra_Bharwad (Brass Contributor)
Solution

@Dharmendra_Bharwad 

Why is the first date the first of the month and all the others the last day of the month?

If you want to round up, why do you want the result for the first date to be the 15th instead of the 16th?

The middle of January is the 16th, not the 15th.

See attached workbook with first date changed to 31-12-2022 for consistency, and a new formula that will work if the dates are all the last day of the month.

View solution in original post