SOLVED

# Datedifference

Highlighted
Occasional Visitor

# Datedifference

Hello Excel Community,

I am having trouble with this Datedif-formula.

I want Excel to count the difference in months between two dates.

This does work, but not in every case like I want it to.

Concretely, I have the following issue:

The difference in Months between 17/09/2018 and 21/09/2020.

Obviously, 24 Months lie between these two given dates.

Although, the 25th Month has already started with 4 days.

Therefore I would like Excel to do the following:

The difference between two dates, expressed in Months, but taking into account the Month that has already started, but hasn't been fully passed.

In the beforementioned example; the outcome is 24 Months and 4 days.

Therefore, I want the outcome to be: 25 Months (instead of 24, as it does so now) .

How can I compute this in a formula?

3 Replies
Highlighted

# Re: Datedifference

ROUNDUP?

=ROUNDUP(DATEDIF(A1,B1,""m""),0)

or

=DATEDIF(A1,B1,""m"")+1

depending on how you want to handle "exactly 24 months"

Highlighted
Best Response confirmed by Tolormo (Occasional Visitor)
Solution

# Re: Datedifference

Perhaps

``=DATEDIF(A1,B1,"M")+1*(DAY(B1)<>DAY(A1))``
Highlighted

# Re: Datedifference

Much better. I honestly don't know what i meant with the ROUNDUP thing.

This should also work (except for day Zero)

``=DATEDIF(A1,B1-1,"M")+1``