SOLVED

Datedifference

Copper Contributor

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?

 

Thank you for your help! 

 

3 Replies

@Tolormo 

ROUNDUP?

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

or

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

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

best response confirmed by Tolormo (Copper Contributor)
Solution

@MindreVetande 

Perhaps

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

@Sergei Baklan 

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

 

1 best response

Accepted Solutions
best response confirmed by Tolormo (Copper Contributor)
Solution

@MindreVetande 

Perhaps

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

View solution in original post