Calculate Elapsed Time in Excel [Quick Tips]
Calculating elapsed time is very common whether you are managing a project or raising a baby. Elapsed time is nothing but interval between a starting point and the current point in time. We can use excel formulas to calculate elapsed time very easily.
Calculating elapsed time in years
For all the examples in this post we assume the starting date and time from which we need to calculate elapsed time is in Cell A1.
To calculate the elapsed time in years, use the formula =(NOW()A1)/365
[Help on NOW formula]
Elapsed time in months
To calculate the elapsed time in months, we can use the formula =(NOW()A1)/30
. This returns the value in 30 day months.
Elapsed time in weeks
To calculate the elapsed time in weeks, we use the formula =(NOW()A1)/7
Elapsed time in days
To calculate elapsed time in days, the formula is simple =TODAY()A1
. [Help on TODAY formula]
The result includes fractions as well. You can use number formatting to remove the values after decimal point.
Elapsed time in working days
To calculate elapsed time in working days, we can use the NETWORKDAYS formula like this = NETWORKDAYS(A1, TODAY())
. This formula assumes 5 working days per week starting with Monday. You can also add an optional list of holidays as a parameter to it.
But if your working week is not from Monday to Friday, you can try the NETWORKINGDAYS() UDF in the same way.
Elapsed time in hours
To calculate elapsed time in hours, we can use the formula =(NOW()A1)*24
Elapsed time in minutes
To find out elapsed time in minutes, use the formula =(NOW()A1)*24*60
Elapsed time in seconds
In some machine critical scenarios, you might want to find the elapsed time in seconds. Just use the formula =(NOW()A1)*24*3600
Download the Elapsed Time Worksheet and see the examples
Click here to download the elapsed time worksheet and play with the examples.
More:
Tips on using date & time in excel, List of excel date & time formulas, More excel quick tips
 
 

Leave a Reply
7 ideas Excel can pickup from iWork Numbers  Pointy Haired Dad 
22 Responses to “Calculate Elapsed Time in Excel [Quick Tips]”
Hi Chandoo,
To calculate time lapses in excel I usually use the DATEDIF function. Even though is undocumented by MS there is a great explanation of its use in Chip Pearson’s site :
http://www.cpearson.com/excel/datedif.aspx
Is pretty easy to use and has great flexibility.
See you and keep Excelling!!!
Another great article, I will be linking to it on my blog.
Oliver:
Yes, I think that DATEDIFF do it better.
Great post! This a fantastic tutorial on calculating elapsed time in Excel that could be helpful even to a novice user. Keep up the useful tips!
Also, the Office community on Facebook could really benefit from you knowledge! Check it out at http://www.facebook.com/office
Cheers,
Andy
MSFT Office Outreach Team
hi, Chandoo !!!
for elapsed time , we can use this unique formula either for hours, minutes or seconds : NOW()A1)
but using respective special number formats
for hours : [h] ==> 46553
for minutes : [m] ==>2793212
for seconds : [s] ==> 167592763
We can also use mean duration for years (orbital period of the Earth around the Sun : ie tropical year) which is : 365.25 days
and mean duration for month : 365.25/12 days
be Excelent !!!!
@Oliver… Thanks for the pointer to datediff(). I will update the post with information about this as well.
@Glen… thanks for the linklove
@Andy… Welcome. Thanks for telling us about the office community on FB.
@Modeste … that is very cool. I will remember these formatting codes for an upcoming article on number formatting codes
Great tip Chandoo! I use the formula to calculate years elapsed all the time. It can seriously help save a ton of time with calculations. Also, NETWORKDAYS is one that helps and can seriously impress a boss. Keep up the great work here!
No problem! I will definitely be directing people with tough Excel questions to your blog. Keep up the great posts!
Andy
MSFT Office Outreach Team
Hi,
always great posts and a good way to start my day
but regarding the elapsed time calculations: have you never noticed that there is a result difference between using =TODAY()A1 and using =NETWORKDAYS(A1,TODAY())?
try it for A1= a Monday such as 21sep09 and “today” is e.g. a Thursday; you get 3 or 4 respectively as a result, depending on the formula used; this is because formula =networkdays() always includes both the startdate and the end date and not only the time between these 2.
This is easily corrected/compensated bij always adding a 1 to the =networkdays() formula because the majority of us will count startday as day 0 and then the result will be consistent across the different formulas.
However, you then get into trouble if you calculate the networkdays for a date further in the past and where either the start or end date falls in a weekend.
just thought to point this out as to me these formula’s are not interchangeable just like that!
have a great day!
Paul
=DATEDIF([DOJ],TODAY(),”Y”) & ” Y, ” & DATEDIF([DOJ],TODAY(),”YM”) & ” M, ” & DATEDIF([DOJ],TODAY(),”MD”) & ” D”
This will fix your 30 Days problem
I calculated the time diff between two date+ times by subtracting 2 cells & custom formatted it to “d hh:mm” format.
E.g.
Cell A1 04Jan12 6:00 PM
Cell A2 05Jan12 4:45 PM
Cell A3 0 22:45 (formula: =A1A2)
Wat shud i do 2 not display the “zero” values i.e. no. of days in this case is zero hence the cell shud display ” 22: 45″ and not “0: 22: 45″.
@Amol
Try the Custom Format code:
[
<
1] hh:mm ; [>=
1] d “d” hh:mmHi Chandoo,
If possible to compute the interval of time and date in one column.
In column C I would like to compute the total days and hours . What formula ? Please help
Example.
Column A Column B
2/13/12 3:30 AM 2/14/12 12:00 AM
In referenc to Elapsed time in months
To calculate the elapsed time in months, we can use the formula =(NOW()A1)/30. This returns the value in 30 day months.
I use to apply formula =ROUND((TODAY()A1)/30,0). Today, I faced a peculiar situation, A1 has date 01Mar2009, and today being 01Mar2012, it should be 36 months, but it is showing 37 months!!
Any suggestions to avoid such errors?
Regards,
Prasad DN
All I want to do is add up a series of times and receive a reply that gives me a total. What I used to do was subtrace the end time from the start time and format the result as [hh]:mm but this doesn’t seem to work anymore. How has Bill Gates confounded me?
@Pete
I use Excel 2010 and it still works
The times must be entered as times in the format hh:mm:ss or hh:mm without seconds
Adding up times is as simple as =Sum(Range) or =Sum(A2:A10)
then using a Custom Number format as you have mentioned [h]:mm
If this isn’t working, 2 ideas
1. Check your times are times and not text
2. Can you share your data or file with us?
My hospital tracks times from patient arrival to various procedures or treatments. When those times cross over midnight, the regular formulas (2nd time minus first time) don’t work because the result is negative and Excel (2007) won’t show a negative number in time format.
I couldn’t find a solution here (chandoo.org) but found one elsewhere that worked and it’s very simple. I would like to share it.
Assuming 1st time in A1 (column for patient arrival time) (11:00 PM), and 2nd time in B1 (column for xray given) (12:30 AM)). Should be 1:30 elapsed time.
=B1A1+(B1<A1) [This comparison is the key to the solution.]
=12:30 AM – 11:00 PM + (12:30 AM < 11:00 PM)
=0.0208 – 0.9583 + (True)
=0.9375 + (1) [This is the key! If it is false, Excel adds 0. If it’s true, Excel adds 1 and that is what corrects the negative number. Now Excel can interpret the number as a time.]
=0.0625
Converted to hh:mm = 1:30
I wrapped this formula inside an IFERROR one to alert my data entry person if she messed up and applied it to lots of different columns and it has worked wonderfully. No more complaints from the data entry person who just plugs in times from medical charts.
Very interesting solution. Thank you so much for sharing it with all of us.
HI,
I am working on a Xl application..
I want to capture time between two clicks.
Ex, in my application during run somewhere I press OK button and then I click Cancel.. I want to measure time between these two clicks… Is it possible??
Pls help on this…
@shashidhar
The answer is Yes
You will have to add an appropriate VBA event to start and stop a timer.
There are techniques which can time to the millisecond so maybe look those up on the net
WOW!!!!!! I truly love your excel time format program! WHOOOO! I am very interested in how the time formats “update” (manually on a physical keyboard) that “updates” the time into its respective decimal time formats, such as:
YYYY.yyyy, HH.hhh, etc…
How do those formulas or equations work if not in Excel mode? Example: TI calculators, Word, or any other computer language programming? Just wanted to see how it works. Email me at Ultra64848689Ti@gmail.com.
Thanks again for an EXCELLENT Excel program into decimal time formats!
Here’s an idea: how about creating an APP for iOS and Android? Just wanted to point that out. =D
Regarding the elapsed time in months:
I made this function to determine the time elapsed since a date using the number of days in each respective month. It’s a simple subtraction and I think it works very well:((Year TodayYear A1)*12++(Month Today – Month A1)+(Day Today/Days in Month Today)Days A1/Days in month A1)
Here’s the function:
=((YEAR(TODAY())YEAR(A1))*12)+(MONTH(TODAY())MONTH(A1))+(DAY(TODAY())/DAY(DATE(YEAR(TODAY()),MONTH(TODAY())+1,0))DAY(A1)/DAY(DATE(YEAR(A1),MONTH(A1)+1,0)))
Have a Merry Christmas everyone!!