ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I calculate exact difference between two dates in y,m,d. (https://www.excelbanter.com/excel-worksheet-functions/110585-how-do-i-calculate-exact-difference-between-two-dates-y-m-d.html)

Muhammad Javaid Hassan

How do I calculate exact difference between two dates in y,m,d.
 
I want to calculate the difference between two dates exactly in years, months
and days. Say between the dates 14-02-1980 to 28-02-1985. The difference is 5
years, 0 months and 14 days including both the starting and ending dates. But
excel does not give the exact answer. Pl help me.

Marcelo

How do I calculate exact difference between two dates in y,m,d.
 
Hi Muhammad,

use the datedif function

=datedif(initial_date,final_date,"X")

X is
"Y" to see the diference in years
"M" to see the diference in months
"D" to see the diference in days
"MD" to see the diference but, months and years are ignorated
"YD" to see the diference but, days and years are ignorated

hth



--
regards from Brazil
Thanks in advance for your feedback.
Marcelo



"Muhammad Javaid Hassan" escreveu:

I want to calculate the difference between two dates exactly in years, months
and days. Say between the dates 14-02-1980 to 28-02-1985. The difference is 5
years, 0 months and 14 days including both the starting and ending dates. But
excel does not give the exact answer. Pl help me.


Domenic

How do I calculate exact difference between two dates in y,m,d.
 
Assuming that A2 contains the first date, and B2 contains the second,
try...

=DATEDIF(A2,B2,"y")

=DATEDIF(A2,B2,"ym")

=DATEDIF(A2,B2,"yd")

Hope this helps!

In article ,
Muhammad Javaid Hassan <Muhammad Javaid
wrote:

I want to calculate the difference between two dates exactly in years, months
and days. Say between the dates 14-02-1980 to 28-02-1985. The difference is 5
years, 0 months and 14 days including both the starting and ending dates. But
excel does not give the exact answer. Pl help me.


Domenic

How do I calculate exact difference between two dates in y,m,d.
 
Correction...

=DATEDIF(A2,B2,"yd")

should be

=DATEDIF(A2,B2,"md")

Hope this helps!

In article ,
Domenic wrote:

Assuming that A2 contains the first date, and B2 contains the second,
try...

=DATEDIF(A2,B2,"y")

=DATEDIF(A2,B2,"ym")

=DATEDIF(A2,B2,"yd")

Hope this helps!



All times are GMT +1. The time now is 10:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com