Date Format: Subtract two dates and convert to Y-M

krbosie

New Member
Joined
Jun 24, 2012
Messages
5
Hi there, I have two cells with dates in them:
eg.
cell k11 has 2009-10-23 in it and cell l11 has 2011-10-13.
I have subtracted the two to get an answer. The answer it gives is 2-1 (2 years and 1 month - This is clearly wrong.
(I used the following formula:
=YEAR(L11)-YEAR(K11)+MIN(0,SIGN(MONTH(L11)+MONTH(K11)))&"-"&MONTH(L11)-MONTH(K11)-MIN(0,SIGN(DAY(L11)-DAY(K11)))+MIN(0,SIGN(MONTH(L11)-MONTH(K11)))*-12&""

How do I do it? What have I done wrong? The answer must be in that exact format: 1-11. I am not interested in the days.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Thanks for the reply: I receive an error, #num - Should I format the cell to something different? I'm using Excel 2010.
 
Upvote 0
Working here

=DATEDIF(K11,I11,"y")&" - " &DATEDIF(K11,I11,"ym")

Excel Workbook
IJKL
1113/10/2011*23/10/20091 - 11
Sheet1
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,165
Members
448,870
Latest member
max_pedreira

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