Using DatedIf for a MM YY calculation difference

RedMisterExcel

New Member
Joined
Oct 26, 2021
Messages
27
Office Version
  1. 2016
Platform
  1. Windows
Hey guys, so I’ve been trying to set up a cell to calculate the amount of months between a start and end date. The problem is, I need to set the dates up so that they are in MM YY format, and when i do that, DatedIf doesn’t seem capable of calculating. Anyone know how to fix this or if it’s just impossible?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
With start date and end date are REAL date, but formatted "MM YY", DATEDIFF still works .
 
Upvote 0
Just playing around, I custom formatted a couple of cells to mm yy and it's still working for me.

=datedif(start_date,end_date,"m)

Can you upload an example?
 
Upvote 0
Just playing around, I custom formatted a couple of cells to mm yy and it's still working for me.

=datedif(start_date,end_date,"m)

Can you upload an example?
Whoops sorry, put B17 twice. HEre you go.
 

Attachments

  • Excel sheet.png
    Excel sheet.png
    15.8 KB · Views: 7
Upvote 0
As was mentioned in the first reply, in order to use DATEDIF, you need REAL dates entered.
You do not have that. As least one of your entries is Text.

As was mentioned, after you enter a real date (real dates require year, month, and day), you can format to show it in "MM YY" format, to display it like that.

If you will always have Text entries, you will need to then convert the values to real dates before you can use the DATEDIF function on them.
 
Upvote 0
As was mentioned in the first reply, in order to use DATEDIF, you need REAL dates entered.
You do not have that. As least one of your entries is Text.

As was mentioned, after you enter a real date (real dates require year, month, and day), you can format to show it in "MM YY" format, to display it like that.

If you will always have Text entries, you will need to then convert the values to real dates before you can use the DATEDIF function on them.
Ah copy, thank you, but here's my thing, for the purposes of this form, I will not know what the days are, only the month/year. Therefore, even if I wanted to, I could not put in a day. Does this mean I can never use DatedIf?
 
Upvote 0
Ah copy, thank you, but here's my thing, for the purposes of this form, I will not know what the days are, only the month/year. Therefore, even if I wanted to, I could not put in a day. Does this mean I can never use DatedIf?
Sure you can.
Since Day is not important to your calculation, simply use "1". Every month has a "1st" in it.
 
Upvote 0
Solution
Sure you can.
Since Day is not important to your calculation, simply use "1". Every month has a "1st" in it.
Copy, thank you. Not an ideal solution (would like to just put MM/YY), but you gotta make lemons with lemonade I guess. Solved.
 
Upvote 0
Copy, thank you. Not an ideal solution (would like to just put MM/YY), but you gotta make lemons with lemonade I guess. Solved.
You are welcome.

It makes more sense when you understand how dates are actually stored in Excel. They are actually stored as numbers, specifically the number of DAYS since 1/0/1900.
You can easily see this if you enter any valid date in Excel, and then change the format of the cell to "General". You will then see the date as Excel sees it.
So in order to store it as a date (which really stores it as a number), you need a Day component to the date to it knows which number to set it to.

The other option would be to enter it as text, and add a date conversion to your formula.
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,680
Members
449,463
Latest member
Jojomen56

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