Duration in Years - Month - Days - Hours - Minutes

shah_ir85

New Member
Joined
May 8, 2016
Messages
40
Hey mate....please help me

i have to calculate duration for 2 date and time. Please help me with the formula on C.

For example

A
B
C
1
Start
End
Duration
2
1 Jan 16 13:30
3 Apr 17 23:45
1 Year 3 Month 2 Days 10 Hours 15 Minutes
3
1 Apr 15 12:40
1 May 17 13:45
2 Years 1 Month 1 Hour 5 Minutes

<tbody>
</tbody>

Please help me if you can tQ
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi,

try this:


Book1
ABCDE
1
2StartEndDuration
31-1-2016 13:303-4-2017 23:451 Year 3 Month 2 Days 10 Hours 15 Minutes1 Year 3 Months 2 Days 10 Hours 15 Minutes
41-4-2015 12:401-5-2017 13:452 Years 1 Month 1 Hour 5 Min2 Years 1 Month 1 Hour 5 Minutes
Sheet2
Cell Formulas
RangeFormula
E3=IF(DATEDIF(A3,B3,"y")=0,"",DATEDIF(A3,B3,"y")&LOOKUP(DATEDIF(A3,B3,"y"),{0,2},{" Year "," Years "}))&IF(DATEDIF(A3,B3,"ym")=0,"", DATEDIF(A3,B3,"ym")&LOOKUP(DATEDIF(A3,B3,"ym"),{0,2},{" Month "," Months "}))&IF(DATEDIF(A3,B3,"md")=0,"", DATEDIF(A3,B3,"md")&LOOKUP(DATEDIF(A3,B3,"md"),{0,2},{" Day "," Days "}))&IF(HOUR(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))=0,"",HOUR(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))&LOOKUP(HOUR(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1)),{0,2},{" Hour "," Hours "}))&IF(MINUTE(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))=0,"",MINUTE(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))&LOOKUP(MINUTE(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1)),{0,2},{" Minute "," Minutes "}))
 
Last edited:
Upvote 0
hey mate...sorry again...error occur for example

start date 6 Aug 17 2230
end date 8 Aug 17 1445

duration 2 Days 16 Hours 15 Minutes

Its should be 1 Day 16 Hours 15 Minutes

please help me
 
Upvote 0
custom format d:hh:mm:ss;@


Excel 2010
ABC
16-Aug-178-Aug-171:16:15:00
5f
Cell Formulas
RangeFormula
C1=B1-A1
 
Last edited:
Upvote 0
try this:


Book1
ABCDE
2StartEndDuration
31-1-2016 13:303-4-2017 23:451 Year 3 Month 2 Days 10 Hours 15 Minutes1 Year 3 Months 2 Days 10 Hours 15 Minutes
41-4-2015 12:401-5-2017 13:452 Years 1 Month 1 Hour 5 Min2 Years 1 Month 1 Hour 5 Minutes
56-8-2017 22:308-8-2017 14:451 Day 16 Hours 15 Minutes
66-8-2017 22:308-8-2017 22:312 Days 1 Minute
Sheet1
Cell Formulas
RangeFormula
E3=IF(DATEDIF(A3,B3,"y")=0,"",DATEDIF(A3,B3,"y")&LOOKUP(DATEDIF(A3,B3,"y"),{0,2},{" Year "," Years "}))&IF(DATEDIF(A3,B3,"ym")=0,"", DATEDIF(A3,B3,"ym")&LOOKUP(DATEDIF(A3,B3,"ym"),{0,2},{" Month "," Months "}))&IF(DATEDIF(A3,B3,"md")=0,"", DATEDIF(A3,B3,"md")-IF((MOD(B3,1)A3,1)),1,0)&LOOKUP(DATEDIF(A3,B3,"md")-IF((MOD(B3,1)A3,1)),1,0),{0,2},{" Day "," Days "}))&IF(HOUR(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))=0,"",HOUR(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))&LOOKUP(HOUR(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1)),{0,2},{" Hour "," Hours "}))&IF(MINUTE(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))=0,"",MINUTE(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1))&LOOKUP(MINUTE(MOD(B3,1)+(MOD(A3,1)>MOD(B3,1))-MOD(A3,1)),{0,2},{" Minute "," Minutes "}))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,741
Members
449,050
Latest member
excelknuckles

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