DATEDIF not working.

Camel123

Board Regular
Joined
Jun 5, 2018
Messages
186
Hi,

Trying to retrieve the number of months between the two dates below. Dates are generated through functions beneath.

2019-01-01
A1=DATEVALUE(YEAR(TODAY())&"-01")

2019-04-01
B1=EDATE(DATEVALUE(MID($C$12;18;4)&"-"&MID($C$12;23;2));1)


=DATEDIF(A1;B1;"M") does not work, returns "1900-01-03" but should return "3" (jan+feb+mar). Cell references are formatted as dates. If dates are not derived from functions then the DATEDIF returns "3".

Any suggestions on how to solve this?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Re: Help, DATEDIF not working.

=DATEDIF(A1;B1;"M") does not work, returns "1900-01-03" but should return "3" (jan+feb+mar).
It looks like it is working. "1900-01-03" is actually 3. Just change the format of that cell from Date to General.
Note that Excel stores dates as numbers, specifically the number of days since "1900-01-00".
So dates are really just numbers with custom date formats.
 
Upvote 0
Re: Help, DATEDIF not working.

It looks like it is working. "1900-01-03" is actually 3. Just change the format of that cell from Date to General.
Note that Excel stores dates as numbers, specifically the number of days since "1900-01-00".
So dates are really just numbers with custom date formats.

Did not even notice haha but... Woho, it worked haha! Thank you :D
 
Last edited:
Upvote 0
Re: Help, DATEDIF not working.

You are welcome!
:)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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