calculate the difference between two dates all in one cell

happydz

New Member
Joined
Jan 11, 2017
Messages
47
Office Version
  1. 2010
Hi guys
I need to calculate the difference between two dates (Days/Months/Years) all in one cell, I tried the formula as shown in the screenshot, but it faild.
I have microsoft office excel 2007
I tried every trick I found on youtube, but none of them worked
It would be very helpful if you create a completed template (excel sheet.xls) so that I will find it easier to edit the dates
thank you in advance
nijv7pa.png
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Looks like you're missing a closing ) try
=IF(DATEDIF(A24,B24,"y")=0,"",DATEDIF(A24,B24,"y")&" Years")&IF(DATEDIF(A24,B24,"ym")=0,"",DATEDIF(A24,B24,"ym")&" Months")&IF(DATEDIF(A24,B24,"md")=0,"",DATEDIF(A24,B24,"md")&" Days")
 
Upvote 0
Works for me

Excel 2013 32 bit
ABC
104/05/200104/06/201514 Years 1 Months
204/05/200106/06/201514 Years 1 Months 2 Days
304/05/201507/06/20151 Months 3 Days
Sheet1
Cell Formulas
RangeFormula
C1=IF(DATEDIF(A1,B1,"y")=0,"",DATEDIF(A1,B1,"y")&" Years ")&IF(DATEDIF(A1,B1,"ym")=0,"",DATEDIF(A1,B1,"ym")&" Months ")&IF(DATEDIF(A1,B1,"md")=0,"",DATEDIF(A1,B1,"md")&" Days ")
 
Last edited:
Upvote 0
Ok, lets break it down
in D1 put =DATEDIF(A1,B1,"y")
in E1 put =DATEDIF(A1,B1,"ym")
in F1 put =DATEDIF(A1,B1,"md")
What do you get?
 
Upvote 0
Ok, lets break it down
in D1 put =DATEDIF(A1,B1,"y")
in E1 put =DATEDIF(A1,B1,"ym")
in F1 put =DATEDIF(A1,B1,"md")
What do you get?
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[/TR]
[TR]
[TD]28-10-17[/TD]
[TD]17-11-17[/TD]
[TD][/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]19[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
P.S: F1 the result should be (20 days) not (19 days)
 
Upvote 0
?? I Get 20 days
what if you use these dates
04/05/2001 06/06/2015
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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