Datedif(??

Pizzio

Active Member
Joined
Apr 28, 2005
Messages
275
I'm looking for a formula that will give me the number of years and months in this format YY.M
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
try:
Excel Formula:
=DateDif(StartDate,EndDate,"M")&"."&DateDif(StartDate,EndDate,"M")

This function has limitations and you should review the conditions where it may provide incorrect results.
Please look at this link:
 
Upvote 0
try:
Excel Formula:
=DateDif(StartDate,EndDate,"M")&"."&DateDif(StartDate,EndDate,"M")

This function has limitations and you should review the conditions where it may provide incorrect results.
Please look at this link:
I'd be surprised if I were right about this, but it looks to me like the first "M" should be a "Y".
Excel Formula:
=DateDif(StartDate,EndDate,"Y")&"."&DateDif(StartDate,EndDate,"M")

Was that a typo, or am I misunderstanding how that formula works?
 
Upvote 0
I'd be surprised if I were right about this, but it looks to me like the first "M" should be a "Y".
Excel Formula:
=DateDif(StartDate,EndDate,"Y")&"."&DateDif(StartDate,EndDate,"M")

Was that a typo, or am I misunderstanding how that formula works?
why would you be surprised? people make typos, my bad.
Thanks for the catch!
 
Upvote 0
why would you be surprised? people make typos, my bad.
Thanks for the catch!
Because usually I'm the one making typos and missing edge cases! You're one of the people on here typically nailing it the first time.
 
Upvote 0
@awoohaw your formula (with @Vogateer ) double counts the years and months. I think the OP wants the M part to be the remaining fraction of a year.
Right, so maybe this would be what he wants?
Excel Formula:
=DATEDIF(startdate,EndDate,"Y")&"."& MOD(DATEDIF(startdate,EndDate,"M"),12)
 
Upvote 0
or possibly
=DATEDIF(startdate,EndDate,"Y")&"."& DATEDIF(startdate,EndDate,"ym")
 
Upvote 0
Because usually I'm the one making typos and missing edge cases! You're one of the people on here typically nailing it the first time.
Thanks, but, i'm not an A lister here. Folks chime in with better, more efficient, and shorter solutions very frequently with me.
 
Upvote 0

Forum statistics

Threads
1,221,558
Messages
6,160,486
Members
451,651
Latest member
Penapensil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top