The tutorial explains different ways to calculate times in Excel and demonstrates several methods of adding times and calculating time difference. You will learn a few useful formulas to sum times and add hours, minutes or seconds to a given time. Continue reading
Comments page 3. Total comments: 622
Hi - I found your blog very helpful. However, I am stuck when trying to find the difference between two date/time stamps while excluding hours outside of 8:00AM to 5:00PM. I know how to calculate NETWORK days and I know how to calculate hours between date/time. I just don't know how to exclude non-working hours.
For example, Cell AA3 is (Autogenerated from database) 10/25/2022 2:21PM and Cell AC3 is 10/26/2022 8:44AM the difference should be 3 hours and 23 minutes (Excluding non working hours). How do I find the difference in NETWORKDAYS and hours together? Or do network days and hours need to be split up into two separate columns? I will need to average out the columns once I figure out the date/time differences between cells.
Thank you and appreciate the help!
Here is where I am at so far...should work...but it doesn't for some reason.
=(NETWORKDAYS(A2,C2) -1)*(upper-lower)+IF(NETWORKDAYS(C2,C2),MEDIAN(MOD(C2,1),upper,lower),upper)-MEDIAN(NETWORKDAYS(A2,A2)*MOD(A2,1),upper,lower)
Hi! Can somebody help me with a formula? I need to compute the rectification time duration between two separate opening hours in a day. The first Opening Hour is from 6:00am to 10:00am, the second is from 7:00pm to 11:00pm. The time in between 10am and 7pm is not counted because it's not within the Opening hours.
1st scenario: If the rectification time is from 7:00am to 8:00am, then the duration is 1 hour.
2nd scenario: If the rectification time is from 7:00am to 3:00pm, then the duration is only 3 hours (10:00am to 3:00pm is not counted because it's not within the opening hours)
3rd scenario: If the rectification time is from 7:00am to 8:00pm, then the duration is 4 hours because the rectification time crossed over the second opening hour (from 7pm to 8pm)
Hope somebody here can help me. Thanks a lot!
Hello!
The start rectification time and end time are written in A2 and A3.
Opening hours are written in A1:D1.
Try this formula:
=IF(B1>A2,B1-A2,0)- IF(A1>A2,A1-A2,0) +IF(A3>C1,A3-C1,0) -IF(A3>D1,A3-D1,0)
Hi Alexander! Thanks a lot for your reply but I always get the answer "4" every time.
Hello!
If I got you right, the formula below will help you with your task:
=(A2<=B1)*((A3-A2)-IF(A1>A2,A1-A2,0)-IF(A3>B1,A3-B1,0)) + ((A3-A2)-IF(C1>A2,C1-A2,0)-IF(A3>D1,A3-D1,0))*(A3>=C1)
Hi! Thank you, Alexander. Will try this out.
This is my formula but is only applicable for Scenario 1 above,
where A2 is start time and A3 end time and B1 is end of 1st opening hour or 10:00am
=IF(A3>=B1,A3-A2,0)
When I apply the above formula for scenario 2 and 3, it will include the number of hours not within the Opening Hours.
I just couldn't get around my head on this.
Thanks!
Hi I have the date and time data where as i need to calculate the hours in logic way
for example : ( 01-12-2022 19:42:00 - 02-12-2022 11:55:00 = -16:13 Hours ) but if i have recd the data on 01-12-2022 post 6:30 PM the time should calculate from next day 9:30 am, so ideally the total time consume from ( 02-12-2022 09:30:00 to 02-12-2022 11:55:00 ) = 2:25 .
Pls provide formula
Alexander sir pls support
Can any one support me in this formula
Hi!
If I understand your task correctly, try the following formula:
=B1 - IF(A1-INT(A1)>TIME(18,30,0), A1+TIME(15,0,0)-(A1-INT(A1)-TIME(18,30,0)), A1)
No Sir it doesn't work,
My task is to understand you { Rec Time - 01-12-2022 13:26:00 } - { Send time - 02-12-2022 19:58:00 } = 30:32 Hour whereas here it is calculating the entire hours
But if i remove the non working hours i;e from > 18:30 then and next day working hours i;e < 09:30 AM. and the send time is { Send time - 02-12-2022 19:58:00 } so ideally total time taken for work is = 10:28 hours
one more example :
Recd Time : 01-12-2022 19:42:00 - Send Time : 02-12-2022 11:55:00 = 16:13 Hours Logically
But
Recd Time : 01-12-2022 19:42:00 - Send Time : 02-12-2022 11:55:00 = 2:25 Mins ( Ideally it should calculate only working Hours ) i have manually removed working hours and calculated here i need this in formula
Sorry for long texture.
Hi!
The formula I sent to you was created based on the description you provided in your first request. However, as far as I can see from your second comment, your task is now different from the original one.
=B1 - IF(A1-INT(A1)>TIME(18,30,0), A1+TIME(15,0,0)-(A1-INT(A1)-TIME(18,30,0)), A1+TIME(15,0,0))
Hi
In my workplace I constantly need to add 50% to the allotted written time for exams.
For example exam time is:
08.00-12.00 and for the students I take care of they get 50% extra time which here would be 08.00-14.00
Is there a formula that can take the original time add 50% and show the result in clock time. If i write 08.00-12.00 I want the next column to show the written times with the added 50%. It would save me a lot of time to not have to count in my head and manually write the time..
Thanx =)
Hello!
Your time values are written as text. Write each time in a separate cell and then you can increase it by a percentage.
Hi,
Is there a way I can combine the formula of concatenate date in one cell and get the difference between the two dates?
Sample:
Cell A1 10/24/2022
Cell B1 13:35
Cell C1 10/25/2022
Cell D1 02:05
Cell E1 =CONCATENATE(TEXT($A1,"mm/dd/yyy")&" "&TEXT($B1,"hh:mm:ss"))
Cell F1 =CONCATENATE(TEXT($C1,"mm/dd/yyy")&" "&TEXT($D1,"hh:mm:ss"))
Cell G1 Result
Thank you in advance
Hello!
The CONCATENATE function converts a date and time to text. You can't do math with text.
Use summation to add time to a date. Maybe this article will be helpful: How to add and subtract times in Excel.
I have used the Formula TEXT and found between 2 different times the hours and minutes. I have done this for a whole month. but now i want the total hours worked on that month. Which function should i use?
Hi!
You can find the answer to your question in this article: How to sum time in Excel.
Hi Sir.Good Day.Please help me with the right formula of late,undertime and Overtime.Im always getting the wrong formula.
Start Time=07:00
End Time=16:00
For late.6min-35min=0.5 36min-1.06hr=1
For undertime.6min-35min=0.5 36min-1.06hr=1
For Overtime.(17:00-17:29=1),(17:30-17:59=1.5),(18:00-18:29=2)
A B C D E
1 IN OUT LATE UNDERTIME OVERTIME
2 07:06 15:55 0.5 0.5
3 07:00 18:20 2
Thank You,
Hello!
To find the desired time interval, use the MATCH function with Match_type=1
In columns A and B, write down the values
07:00 0
07:06 0.5
07:36 1
08:06 1
08:07 0
14:54 1
15:25 0.5
15:55 0
17:00 1
17:30 1.5
18:00 2
18:30 0
Formulas for calculating of late, undertime and overtime:
=INDEX(B1:B5,MATCH(D1,A1:A5,1)) late
=INDEX(B6:B8,MATCH(E1,A6:A8,1)). undertime
=IFERROR(INDEX(B9:B12,MATCH(E1,A9:A12,1)),0) overtime
Hope this is what you need.
If i want to do an if statement based on the # of hours, what am i missing.
eg. 4hrs=$50, 4-8hrs=$100, >8hrs=$150
cell a1=1:00am, b1=6:00am, c1=b1-a1, d1=IF(C1<4,50,IF(AND(C14),100,150))
I've tried the above but c1 does not give me 5 as the answer unless i turn it to "hour" format, and d1 gives me answer of 150.
Final answer should be 100 as it falls within 4-8hrs.
Hello!
To convert time to hours, multiply by 24 as recommended in this article.
(B1-A1)*24
Then use a nested IF function:
=IF(C1>8,150,IF(C1>4,100,50))
Thanks for your feedback. Really appreciate.
All 24H format (Format Cell > Time > 13:30)
Example #1
O8: 3:00
P7: 11:30
Normally must show 3:30
Trying what you say:
=IF(O8>P7,P7-O8+1,P7-O8)
Give 15:30, which is not ok because show result on 24 formats.
Example #2
O11: 4:00
P10: 14:30
Normally must show 10:00
Trying:
=O11+1-P10
Give 10:00, which is ok
Thanks by advance!
Hi!
The result of your example 1 I can't understand and repeat. Excel stores time in 24-hour format. Please read the above article carefully. 11:30 is 11:30, not 23:30. Write the time correctly.
Hi,
In the following, I want: End – Begin.
Format of time is 24 hours (0:00 = 24:00)
For example:
Begin 11:30
End: 3:00
End - Begin = 3:00–11:30 = 15:30
Begin End
11:30 3:00
11:30 4:00
14:00 4:00
13:30 5:00
10:30 4:30
14:00 5:30
12:30 5:00
15:00 6:00
14:00 5:00
16:00 7:00
14:00 7:00
14:00 9:00
17:30 9:00
17:30 9:00
14:30 9:00
16:00 10:00
13:30 0:00
13:30 0:00
5:30 17:00
2:30 22:00
3:30 22:00
5:00 22:30
4:50 20:45
6:40 21:40
6:15 22:30
6:20 0:30
6:05 0:30
6:25 0:00
Thanks by advance.
Hi!
The question of how to find the time difference if the end time is less than the start time has been asked many times already. See the answer in this comment.
Hello,
I have read your post and the comments but I can't find what I need. I am trying to figure out the hours between days in military time. If possible I am trying to gee the dates in separate cells. i.e. Start date, start time, end date, end time. Product would be total hours. (3/19/2012, 0645, 3/20/2012, 1400, total is 31.25 hours)
Please help,
Thank you,
Carlos
Hello!
Use the TIME function to convert text to time. Find the date and time difference and multiply by 24 to get the hours.
=(C1+TIME(LEFT(D1,2),RIGHT(D1,2),0)-A1-TIME(LEFT(B1,2),RIGHT(B1,2),0))*24
I hope it’ll be helpful.
Hi there,
I am trying to calculate time between two points in a video. For example, finding the difference between 02.54.42 (2 minutes, 54 seconds, 42 milliseconds) and 01.29.99 (1 minute, 29 seconds, and 99 milliseconds). I have tried formatting the cells to mm.ss.00 and subtracting using =A1-B1 (A1 having the larger number) but I get an error #VALUE. I want the answer to come out in the same format. Do you have any tips for making this calculation work in excel?
Hi!
To calculate the time difference in milliseconds, write the minutes and seconds in separate cells. For example, A1=2, A2=54.42
Use formula
=(A1/1440+A2/86400)-(B1/1440+B2/86400)
and set custom time format hh:mm:ss.000
I hope it’ll be helpful.
How to use formulas to the full column.
Hi!
The following tutorial should help: The fastest way to insert a formula into the entire column. I hope it’ll be helpful.
I wanted to calculate 5 digit hours with minutes, but I am unable to do so. For eg : 12345:55 + 54231:02 = 66576:57, But I dont know how to do this in excel, Please can someone help me with the same?
Hi!
Excel does not have such a time format. Your task is impossible.
Write hours and minutes as separate numbers.
Hello there,
I am struggling with the following scenario. I work for an airline. I am trying to calculate delays. For example, a flight was scheduled to arrive at 23:32. The actual arrival time is 00:15. How would I calculate the results to show the amount of time the flight was delayed when it crosses over into the next day? I tried something like this, but I am not getting the results I wanted: =IF(E21-D21>0,E21-D21,"-"&TEXT(ABS(E21-D21),"h:mm")) The result comes back as -23:17. Thank you for your help!
Hi!
This question has already been discussed many times on our blog. If the start time is greater than the end time, then use the formula:
=IF(A1>B1,B1+1-A1,B1-A1)
Don't forget to set the time format in the cell.
i have two columns in Excel 2016. the first beginning with 5/1/2022 11:44, the second column 2d 23h 47min, I need to have a formula that can add these two columns and come up with a third column with new m/d/yyyy h:mm.
Hello!
You can extract three numbers from the text into separate cells with the help of these formulas:
=--CONCAT(IF(ISNUMBER(--MID(MID(A2,1,SEARCH(" ",A2)-1),ROW($1:$94),1)),MID(MID(A2,1,SEARCH(" ",A2)-1),ROW($1:$94),1),""))
=--CONCAT(IF(ISNUMBER(--MID(MID(A2,SEARCH(" ",A2)+1, SEARCH(" ",A2,SEARCH(" ",A2)+1)-SEARCH(" ",A2)-1),ROW($1:$94),1)), MID(MID(A2,SEARCH(" ",A2)+1,SEARCH(" ",A2,SEARCH(" ",A2)+1)-SEARCH(" ",A2)-1),ROW($1:$94),1),""))
=--CONCAT(IF(ISNUMBER(--MID(MID(A2,SEARCH(" ",A2, SEARCH(" ",A2)+1),20),ROW($1:$94),1)), MID(MID(A2,SEARCH(" ",A2,SEARCH(" ",A2)+1),20),ROW($1:$94),1),""))
To convert these numbers to time, use these guidelines: How to convert numbers to time format in Excel.
I have two dates = 02/22/2022 11:00 AM & 03/22/2022 08:26 AM and I am using formule INT(date1 -date2.
format of both excels is the same still I recieve #value error. Please help.
Hello!
Error #value! indicates that your dates are written as text. Try to use the recommendations described in this article: Convert text to date and number to date.
I am trying to do a countif based on times. For example, I have an activity that occurs at any point within 24 hours. I am trying to count how many times the activity occurs between 07:00 and 19:00 (18:59, actually). I have dates associated with the times as well which I don't need for this calculation. For example, in a data set that includes the two cells with the following information:
1/15/21 4:13
2/13/21 15:50
I would like to include the second cell (time of 15:50) into my countif but not the first cell (time of 4:13).
How could this be addressed?
Hello!
Using the INT function, you can extract the time from a date.
=SUM(((A1:A10-INT(A1:A10))>=7/24) * ((A1:A10-INT(A1:A10))<=19/24))
This should solve your task.
How to Calculate Hours between two Times in ONE CELL.
For Example.
My input in A1 is [10-10]. Its Hours to Hours. If I'm working 10:00 AM to 10:00 PM its total 12 hours.
So how can I get TOTAL Hours if I give input [hours AM - hours PM] in a single CELL
Hi!
Your data is text. Extract each value from the text and convert it to time using the VALUE function
For example,
=VALUE("10 PM")
You can find more examples and instructions here: Excel VALUE function - convert a text string to date and time.
Hello Alex, thankyou for your post, can you help me with my problems? I really hope you can assist me
I want to know how to subtract the video time duration from the video remaining time duration
for example, I want to convert 01:10/01:38:30 (video duration time) to the 01:37:20/01:38:30 (video remaining time)\
all I want to do is just substracting 01:38:30 to 01:10 but the excel format keeps converting my time duration to AM and PM format
I really hope you can answer me, thank you Alex
Hello!
If I understand correctly, you can use a custom time format. Read detailed instructions in this article.
I hope my advice will help you solve your task.
Hello, can you help me with my problem?
I have database where is a lot of cells with contains time in the format for example 1h 30m
Is it possible to automatically convert that format to something like that: 1:30 ?
I will be very thankful for your help
Hello!
To convert your text into time, use the formula -
=--SUBSTITUTE(SUBSTITUTE(A1,"m",""),"h ",":")
Then set the time format for the cell.
I have data where the initial clock was set wrong e.g., 1/9/1930 11:00 but should have been 9/14/2021 1:15. I can get the date corrected using =DATE(YEAR(B3)+91, MONTH(B3)+8,DAY(B3)+5) and time corrected using =B3+TIME(2,15,0). Is there a way to correct them both using one formula and keeping the original format? When I tried =B3+(47829600/1440) it returns only the date and no time. Thanks
Hello!
Time is a fraction of a number. You can get it using the INT function.
=DATE(YEAR(B3)+91, MONTH(B3)+8, DAY(B3)+5)+B3-INT(B3)+TIME(2,15,0)
Hope this is what you need.
Hi! Thank you so much for this instruction! I didint found one more thing i was looking for.
So,
Im working between 7.00am - 3:30pm monday - friday. I have these "saldo hours". You can collect 1 saldo hour before 7.00am and 3 saldo hours after 3.30pm.
Example
Working between 6:45am - 3:35pm. Get paid normal 8h (30min not paid lunch break) and collect 20minutes of saldo.
Now my saldo is +0:20h
Next day working 6:00am - 3:15pm Get paid normal 8h (30min not paid lunch break) and collect 45minutes of saldo. (coming 60min before and leaving 15min early - total 45min)
Now my saldo is +1:05h
So how to create this kind of function or formula, which can trakt the saldo hours?
Thank you so much!!
Hi!
Determine the time using the TIME function. Use the IFERROR function to avoid errors in the calculation result.
=IFERROR(TIME(7,0,0)-A1,0)+IFERROR(B1-TIME(15,30,0),0)
I hope my advice will help you solve your task.
Hi!
Thank you for fast answer!
That is not working.
I use one column for time i go to work, next column for time i leave. Third column calculate the total time with this formula =(C3-B3)-TIME(0;30;0).
But how i can create the forumula calculate from that time what is normal work hours (8h) and after that rest goes to saldo.
Thank you!
Hi!
The formula I sent to you was created based on the description you provided in your first request.
The formula calculates the saldo you wanted to calculate. Explain what exactly doesn't work.
Hi!
Now its working, i had some typo with , and ;.
Thank you so much!
I have one another problem, what i cant solve, in another thing.
So i use this device to measure things and i use excel to collect data. Somehow this device sending data in "wrong" format. So if the decive show negative value excel turn it positive with + and if value is positive excel shows also positive value without +. And i need to keep number format in "text" otherwise there is problem with formula.
Example:
Device value is -0,12 -> excel shows +0,12
Device value is 0,13 -> excel shows 0,13
Is there anything i can do in excel? From device side there is nothing i can do.
Hi!
If I understand your task correctly, try the following formula:
=--(SUBSTITUTE(A1,"+","-"))
Other ways to convert text to number you can read in this article.
Hi!
Now everything is working right! Thank you very much!
One more thing.. sorry to replay so many times..
What if the saldo is negative? that formula is not working for that. Sometimes i do short day and use saldos.
example
working between 06:00 - 14:00, so saldo go negative 0:30h.
thank you!
Hi!
The formula I sent to you was created based on the description you provided in your first request.
If you had specified all the terms at once, we would have saved a lot of time.
=IF((((TIME(7,0,0)/24-A1/24)+(B1/24-TIME(15,30,0)/24))*24)<0, "-"&TEXT(-((TIME(7,0,0)/24-A1/24)+(B1/24-TIME(15,30,0)/24))*24,"h:mm"), ((TIME(7,0,0)/24-A1/24)+(B1/24-TIME(15,30,0)/24))*24 )
Use time format in this cell.
Negative time is written as text.
Hello,
Thanks for the tips. Unless I missed it in the article, I'm not seeing the solution I'm looking for. I'm planning courier routes and would like to display the transfer time for each stop. For the first column, I have the arrival time (e.g., 8:00AM). For the second, column, I have the transfer time listed (e.g., 8:00AM - 8:15AM). Is there a function I can use to display the transfer with the only variable being transfer time (e.g., 15 minutes, 30 minutes, etc.?) or would this require additional columns?
Thanks!
Hello!
If I understand you correctly, you want to add time to the arrival time (15 minutes)
Please try the following formula:
=A1+TIME(0,15,0)
If this is not what you wanted, please describe the problem in more detail.
Hello,
This is close, but I'm also hoping there is a way to display both the original time and the time plus variable in the same cell so that if the first column reads 8:00AM, the second column would read 8:00AM - 8:15AM.
Thanks so much
Hi!
To show the time as text in the format you want, use the TEXT function.
You can use this formula:
=TEXT(A1,"h:mm AM/PM")&" - "&TEXT(A1+TIME(0,15,0),"h:mm AM/PM")
Hi
How do I calculate with formula the number of hours , e.g. 0800-1700 ?
Hello!
Convert text to time using the TIMEVALUE function -
=TIMEVALUE(MID(A1,6,2)&":"&RIGHT(A1,2)) - TIMEVALUE(LEFT(A1,2)&":"&""&MID(A1,3,2))
Don't forget to set the time format in the formula cell.
hi!, I've managed to get the formula to successfully work with only 1 time in and 1 time out. how do i add more times to the formula. for example i want to calculate how long i was working for. i signed it at 8, signed out at 12:30 for lunch. signed back in at 1:30 and signed out at 5:15 at the end of the day. how do i make this a formula that calculates the number of hours and number of remaining minutes separately.
Hi!
I recommend reading this guide: How to convert time to decimal number, hours, minutes or seconds in Excel. I hope it’ll be helpful.
How do I update this formula from using an 8 hour shift to a 10 hour shift? ,TIME(E6+8-INT(E11),F6+30-(60*(E11-INT(E11))),0),TIME(E6+8-INT(E11),F6-(60*(E11-INT(E11))),0)))))
Hi!
I cannot guess what your formula is doing. But you can try changing the number 8 to 10. If that doesn't help, give more information about your problem.
How to subtract dd-mm-yy hh:mm am/pm valeues in excel (12hours format)
For example
2/17/22 12:00pm -2/17/22 2:00pm = 2 hours
How to get this in excel
Hello!
I recommend you read these tips.
I hope it’ll be helpful.
My question is stock movement date is
2022-02-14 16.51.12
Gate entry date is
2022-02-14 16.48.27
Please help me how to calculated this hours, min, second
Hello!
If your data is written in date and time format, calculate the difference between these cells and set the cell with the formula to the time format.
If your data is written as text, use these guidelines: How to convert text to date in Excel.
I hope it’ll be helpful. If something is still unclear, please feel free to ask.
How to subtract 30 min if the shift is for 8hr 30 min .
Hello!
To extract minutes from time, use the MINUTE function.
If this is not what you wanted, please describe the problem in more detail.
How to determine a work shift, 06:30 to 18:59 - Morning, 19:00 to 06:29 - Night.
=IF([@[Clock In Time]]>=TIME(6,30,0),IF([@[Clock In Time]]<=TIME(18,59,0),"Morning","Night"))
Had try this formula but when key the clock in time between 01:00 - 06:29, it will come out "FALSE"
please help....
Hello!
Please try the following formula:
=IF(AND([@[Clock In Time]]>=TIME(6,30,0),[@[Clock In Time]]<=TIME(18,59,0)),"Morning","Night"))
I can't check the formula that contains unique references to your workbook worksheets, sorry.
it doesn't work :(
Hi!
Maybe your links were wrong.
=IF(AND(A2>=TIME(6,30,0),A2<=TIME(18,59,0)),"Morning","Night")
Hello sir ,
I have one task to solve . In our company there is 3 working shifts are there,
1. 06:30 to 15:30 shift A
2. 15:30 to 23:30 shift B
3. 00:30 to 06:30 shift C
and i want to add one column which give me only shift name when the employee place there entry in any time
for example if
if employee enter after 06:30 but before 15:30 then formula should give value "A"
if employee enter after 15:30 but before 23:30 then formula should give value "B"
if employee enter after 00:30 but before 06:30 then formula should give value "C"
Please guide sir , what will be the best formula ?
Hello!
If I got you right, the formula below will help you with your task:
=CHOOSE(IFERROR(MATCH(1,($A$1:$A$3D1),0),3),"A","B","C")
Column A - the beginning of the shift, Column B - the end of the shift. D1 is the time entered by the employee. Determine the desired interval number using the MATCH function. The CHOOSE function will replace the interval number with the desired letter.
In excel, How to subtract 4:58:00 Hrs from 02/07/2022 04:27:00 ?
Hello!
If your value is written in date and time format, then you can extract the time in the way described in this example
=A1-INT(A1)
Set time format in this cell.
But you can't get the time 4:58:00 from your value. Only 04:27:00.
Hello!!! Can I ask what formula should I use if the driver is arriving to job and he is paid for waiting time 30.08€ per after 45 minutes. I need first to find how many minutes and then how much they will get paid. Thank you very much indeed.
Hi!
The number of minutes divided by 45 and multiplied by 30.08
How to convert 2 days 19:30:18.530787 into total hours and minutes.
Hello!
To convert text to date and time, use the formula
=LEFT(A2,SEARCH(" ",A2)-1)+TIMEVALUE(MID(A2,SEARCH(" ",A2,6)+1,8))
Then set a custom time format [h]:mm to show times over 24 hours as described in this tutorial.
Hi I'm trying to calculate -minus break times, without the break time being displayed. So for example
if total hours is greater than 4:30-0:15=04:15
if total hours is greater than 6:00-0:20=05:40
If total hours is greater than 8:00-0:30=07:30
But all in the same Formula if that makes sense. Is this possible?
Hello!
If I understand your task correctly, use formula with nested IF function:
=IF(A2 > =TIME(8,0,0),A2-TIME(0,30,0),IF(A2 > =TIME(6,0,0),A2-TIME(0,20,0),IF(A2 > =TIME(4,30,0),A2-TIME(0,15,0),A2)))
I'm calculating time difference with dates using the formula:
=TIME(HOUR(A2), MINUTE(A2), SECOND(A2)) - TIME(HOUR(B2), MINUTE(B2), SECOND(B2))
The issue occurs when attempting to calculate the time elapsed in H:MM:SS for when it rolls into the next day, ie 12/01/2021 19:37 to 12/02/2021 03:40 .
Is there a better formula to use when for the example above or a way to convert the data of the 12/02/2021 03:40 and use the same formula?
Thank you
Hi!
This issue has already been discussed many times in our blog. For example, read this comment.
How to convert 13451 into Hours and minutes?
Hi!
You have not explained what your number means. I guess it's minutes. I recommend checking out this guide:
How to convert numbers to time format
To convert minutes to time format, divide by 60 and 24. Set the time format you need in the cell.
=A1/60/24
Hi, I am looking for what I believe is a simple solution, but, I think that I am just not "asking" google the right question LOL
Anyways, I have my time total figured out.
3:20 pm - 3:20 am - 12hours.
Now, I would like to take that 12 hours (say it is in cell u7) and have it show 8 hours in d7 (regular time), anything over 8 hours (up to 3 hours) to show in e7 (overtime). Then, anything over that 3 hours, to show in i7 (double time).
Thank you.
Hello!
If I understand your task correctly, the following formulas should work for you:
=IF(U7>TIME(8,0,0),TIME(8,0,0),U7)
=IF(U7>D7,IF(U7-D7>TIME(3,0,0),TIME(3,0,0),U7-D7),"")
Hope this is what you need.
Hi there! Thank you so much for this post!
I have a question. I've set up a sheet with the formula shown here =TEXT(D2-C2, "h:mm") where I calculate the amount of minutes/hours worked on specific tasks. I then wanted to add all of these together, but not sure how to go about it, as =SUM() of all of those =TEXT() doesn't work at all...
Could you point me in the right direction please?
Thank you!
Hi!
Subtract the original time data with something like this:
=SUM(D2:D9-C2:C9)
I hope it’ll be helpful.
It really works. Thank you very much
I am trying to use a simple formula that will auto sum total hours worked. Everything works fine as long as the cells that are being added include an increment of at least one hour. However, all of the fields that have an amount between :01 and :59 are being 'skipped over' in the formula. Please see my example below:
Day 1 Day 2 Day 3 Day 4 Day 5 Total Hours Worked
1:00 1:00 1:00 1:00 :05 4:00
As you can see, Day 5 was not included in the sum of the cell 'Total Hours Worked', and I can't see to figure out how to manipulate excel to include it.
Hello!
Only numerical values can be added.
:05 is text, not a number. Write down the time in the correct format and you will be fine.
How do I get excel to choose from four cells, the one with the time in it, and then find the difference between it and a finish time
Hi. I am preparing attendance sheet in excel but daily basis I am adding labor intime (as one day present) and want total attendance days in the total of each employee.
Please guide how to do so?
Hello!
To calculate the sum of days for each employee, I recommend using the SUMIFS function.
I am wondering how to calculate the time of 23:09:54 of 7/9/2021 to 0:32:32 of 8/9/2021. How do I calculate the time difference/ time worked? What do I write in the excel sheet ? Do i need to add the dates ? Does it only work for 12- hour clock? What formula should I use?
Hi!
If your data is recorded as date and time, use subtraction. If the time is recorded separately and if the end time is longer than the start time, then you need to add 1 day to their difference
=IF(A1 > A2,A2-A1+1,A2-A1)
Hi, i have 10 employees who rotate day and night shift, i want to setup a formula that i dont have to manually calculate their times clocked in all the different areas - example:
EmployeeA clocks in on night shift at 18h00 at the main gate then clocks at 19h30 in at the offices, again clocks in at Lamproom at 20h00 he clocks out at Lamproom at 23h00 at office 24h45 and out at main gate at 02h00am (next morning). i need to calculate what his total shift was ie. 8hrs, shift underground (lamproom in and out), the differences between main gate and office 1h30 and office to lamproom - is there a way i can do this on excel? i tried Pivot but the pivot doesnt calculate the time worked it only sums/counts
Hello!
If the end time is longer than the start time, then you need to add 1 day to their difference
=IF(A1 > A2,A2-A1+1,A2-A1)
Calculate the amount of time differences.
=IF(A1 > A2,A2-A1+1,A2-A1)+IF(A3 > A4,A4-A3+1,A4-A3)+IF(A5 > A6,A6-A5+1,A6-A5)
Hi thank you for sharing this, I have a problem with my formula with hours that formulated using =MOD and the formate number is [h:mm]. Now the problem was whenever I multiplied the hours into $ pay rate, it is showing a wrong result. :(
Hi!
What formula are you using? Explain with your data.
Hi,
1)I have applied a mid function as =MID(H2,11,8) which is 08:11:08 and also add 4 hrs which is TIME(4,0,0).
But when I add the time the result becomes 12:12PM Because I am applying on the above formula.
How I ll get the result as 12:12:18 without showing AM/PM?
2) how can I convert 08.11.08 to 08:11:08?
Please help.
Hello!
Here is the article that may be helpful to you: How to change Excel date format and create custom formatting
The MID function is used to work with text, not dates.
Ok, I ll try with text.
What will be the formula for 2nd one? Please help
Hi!
To replace characters in text, use the SUBSTITUTE function:
=SUBSTITUTE(A1,".",":")
Is there a way to make the end result a decimal number? Here is what I am trying to do:
Time In Time Out Total Hours
8:30 AM 4:00 PM 7.5
When I follow the formula in the example above I just get 7 for the total hours.
Thank you.
Hi!
There are many formulas in this article. Which one are you using?
Formula 2. Calculating time difference with the TEXT function
I want to calculate the median and mean. Say I have column of 500k rows, which have the time difference between 2 timestamps written as "0 days, 0 hours, 27 minutes and 53 seconds". How do I calculate the median and mean of these?
Hi!
Your timestamp is recorded as text. Therefore, no mathematical operations with it are possible.
Hello,
I need to substract the breaks from the gross working hours. I can't find the right formula.
Example : if working hours 3.5 to below 6 hours (3.5 hours to 5.9 hours) substract 30 min break time, if hours 6 to overs, substract 60 minutes.
Could you please hepl me for solve this?
Thank you
Hi!
See the answer in this comment.
Hi! Sorry to bother you. For your info, I've tried this formula many times, but it's not working with my time. If you could please do my formula again with my time, I will be grateful to you.
Thank you.
Hello,
How to create formula that calculate time in a single cell? For example Cell A1 (4:30pm - 7:30pm) Cell A2 ( 3 hours). Please advice.
Thanks
Hello!
Please check the formula below, it should work for you:
=(MID(A1,SEARCH("–",A1,1)+2,LEN(A1)-SEARCH("–",A1,1)-3)&" "&RIGHT(A1,2))-(LEFT(A1,SEARCH("–",A1,1)-4)&" "&MID(A1,SEARCH("–",A1,1)-3,2))
dear alex,
thanks for the formula, but i still couldn't get it. possible to assist me in more detail for the formula above?
Thanks.
Hi!
Use the General format in a cell with a formula to see all digits in a number. Use the time format to see 03:00:00 instead of 0.125
with the formula you given, the answer i get at cell A2 was 0.13 instead of 3.
Hello,
I need to substract the breaks from the gross working hours. I just can't find the right formula even after reading so many comments.
The conditions are: if working hours >=9 substract 30 min break time, if hours are between 9 and 10, substract 45 min break time, if hours over 10, substract 60 minutes.
Could you please give me advice for this?
Thank you
Hello!
The formula below will do the trick for you
=IF(HOUR(A1)>=10,A1-60/1440,IF(HOUR(A1)>=9,A1-45/1440, A1-30/1440))