The tutorial demonstrates different ways to convert time to decimal in Excel. You will find a variety of formulas to change time to hours, minutes or seconds as well as convert text to time and vice versa.
Because Microsoft Excel uses a numeric system to store times, you can easily turn hours, minutes and seconds into numbers that you can use in other calculations.
In general, there are two ways to convert time to decimal in Excel - by changing the cell format and by using arithmetic calculations or Excel time functions, such as HOUR, MINUTE and SECOND. Further on in this tutorial, you will find the detailed explanation of the first way and formula examples demonstrating the other technique.
How to convert time to decimal number in Excel
Overall, there are three ways to change a time value to a decimal number: arithmetic operation, CONVERT function or a combination of three different Time functions.
The easiest way to convert time to decimal in Excel is to multiply the original time value by the number of hours, seconds or minutes in a day:
- To convert time to a number of hours, multiply the time by 24, which is the number of hours in a day.
- To convert time to minutes, multiply the time by 1440, which is the number of minutes in a day (24*60).
- To convert time to seconds, multiply the time time by 86400, which is the number of seconds in a day (24*60*60 ).
In the following sections, you will learn the other methods of converting times to a decimal number in Excel.
How to convert time to hours in Excel
This section demonstrates 3 different formulas to convert hours from the standard time format (hh:mm:ss) to a decimal number.
Formula 1: Arithmetic calculation
You already know the fastest way to convert a time value to a number of hours in Excel - multiplying by 24, i.e. by the number of hours in one day:
=A2*24
Where A2 is the time value.
To get the number of compete hours, embed the above formula in the INT function that will get rid of the fractional part:
=INT(A2*24)
Formula 2: CONVERT function
Another way to perform the "time > hours" conversion is to use the following Convert formula:
=CONVERT(A2, "day", "hr")
Formula 3: HOUR, MINUTE and SECOND functions
Finally, you can use a bit more complex formula, whose logic, however, is quite obvious. Extract the individual time units by using the HOUR, MINUTE and SECOND functions, then divide minutes by 60 (the number of minutes in an hour) and seconds by 3600 (the number of seconds in an hour), and add up the results:
=HOUR(A2) + MINUTE(A2)/60 + SECOND(A2)/3600
How to convert time to minutes in Excel
The same three methods can be used to convert minutes from the standard time format to a decimal number.
Formula 1: Arithmetic calculation
To convert time to total minutes, you multiply time by 1440, which is the number of minutes in one day (24 hours * 60 minutes = 1440):
=A2*1440
If you want to return the number of compete minutes, utilize the INT function like in the previous example:
=INT(A2*1440)
You can view the results in the screenshot below:
Formula 2: CONVERT function
To do the "time > minutes" conversion with the CONVERT(number, from_unit, to_unit) function, supply "day" as the unit to convert from and "mn" as the unit to convert to:
=CONVERT(A2, "day", "mn")
Formula 3: HOUR, MINUTE and SECOND functions
One more way to get the number of minutes is to multiply hours by 60 and divide seconds by the same number:
=HOUR(A2)*60 + MINUTE(A2) + SECOND(A2)/60
How to convert time to seconds in Excel
Converting time to total seconds in Excel can be done in a similar fashion.
Formula 1: Arithmetic calculation
Multiply the time value by 86400, which is the number of seconds in a day (24 hours * 60 minutes * 60 seconds = 86400):
=A2*86400
Formula 2: CONVERT function
The formula is basically the same as in the above examples with the only difference that you convert the "day" unit to "sec":
=CONVERT(A2, "day", "sec")
Formula 3: HOUR, MINUTE and SECOND functions
Use the HOUR, MINUTE and SECOND functions like in the two previous examples (I believe at this point you don't need any further explanation of the formula's logic :)
=HOUR(A2)*3600 + MINUTE(A2)*60 + SECOND(A2)
Tips:
- If any of the above formulas returns a value formatted as time, simply change the cell's format to Generalto display it as a number.
- To convert time to a decimal number that represents the time in the internal Excel system, apply the General format to the cell. With this approach, 23:59:59 will be converted to 0.99999, 06:00 AM to 0.25, and 12:00 PM to 0.5. If an integer part of the converted number is greater than zero, it means that your cell contains both date and time values.
How to split date and time in Excel
As is often the case, your Excel worksheet may contain dates and times in one cell, while you want to split them into two separate cells.
Remembering that in the internal Excel system the date value is stored as a whole part and the time value as a fractional part of a decimal number, you can extract the date using the INT function, which rounds the cell value down to the nearest integer.
Supposing your original dates and times are in column A, the following formula will accomplish the separation:
=INT(A2)
To extract the time portion, subtract the date returned by the above formula from the original date and time value:
=A2-B2
Where column A contains the original date & time values and column B contains the dates returned by the INT function.
If you'd rather not have time values linked to the separated dates (for example, you may want to remove the date column in the future), you can use the following MOD formula that refers to the original data only:
=MOD(A2,1)
Tip. If the separated date and time values are not displayed properly, change the format of the new columns to Date and Time, respectively.
This is how you split date and time in Excel. If you want to further separate hours, minutes and seconds into individual columns, then use the HOUR, MINUTE and SECOND functions, as demonstrated in How to get hours, minutes and seconds from a timestamp.
How to spell time in Excel
Sometimes, you may need to convert time into the format that reads something like "# days, # hours, # minutes and # seconds". A good thing is that you already know all the ingredients of the formula:
- Extract days using the INT function;
- Extract time units with HOUR, MINUTE and SECOND functions, and
- Concatenate all parts in a single formula.
Having difficulties with figuring out a proper formula for your worksheet? The following example will make things easy!
Supposing you have the dates of upcoming events in column B beginning in cell B4, and the current date and time returned by the NOW() function in cell B1.
The formula to calculate the time difference is as simple as =B4-$B$1
. Of course, nothing prevents you from subtracting the current date and time directly with =B4-NOW()
.
And now, let's make a countdown timer that would show how many days, hours, minutes and seconds are left until each event.
The formula to enter in cell D4 is as follows:
=INT(C4) & " days, " & HOUR(C4) & " hours, " & MINUTE(C4) & " minutes and " & SECOND(C4) & " seconds"
If you wish to get rid of 0 values, like in cells D6 and D7 in the screenshot above, then include the following IF statements:
=IF(INT(C4)>0, INT(C4)&" days, ","") & IF(HOUR(C4)>0, HOUR(C4) & " hours, ","") & IF(MINUTE(C4)>0, MINUTE(C4) & " minutes and ","") & IF(SECOND(C4)>0, SECOND(C4) & " seconds","")
All zeros are gone!
Note. When either of the above formulas refers to a negative number, the #NUM! error will appear. This may happen when you subtract a bigger time from a smaller one.
An alternative way to write time in words in Excel is to apply the following custom time format to the cell: d "day," h "hours," m "minutes and" s "seconds". No formulas and no calculations are required! For more information, please see Creating a custom time format in Excel.
Convert text to time in Excel
If your time formulas and calculations do not work right, time values formatted as text is often the cause. The fastest way to convert text to time in Excel is using the TIMEVALUE function.
The Excel TIMEVALUE function has just one argument:
Time_text is a text string in any of the time formats that Excel can recognize. For example:
=TIMEVALUE("6:20 PM")
=TIMEVALUE("6-Jan-2015 6:20 PM")
=TIMEVALUE(A2)
where A2 contains a text string
As you see, the formulas with cell references and corresponding text strings deliver identical results. Also, please notice the left alignment of time strings (text values) in cells A2 and A6 and right-aligned converted time values in column D.
Convert time to text in Excel
Supposing you have an Excel file full of times formatted to look like "8:30:00 AM" and you want to convert them to the text format. Simply changing the cell's format to TEXT won't work because this would change your time values to underlying numeric representation of the time. For example, 8:30:00 AM will be converted to decimal 0.354166666666667.
So, how do you convert cells to the text format so that your cells still have the time in them? The answer is to use the TEXT function that converts a numeric value to text with the display formatting that you specify, for example:
=TEXT($A2,"h:mm:ss")
The screenshot below demonstrates other possible formats:
How to convert numbers to time format in Excel
If you have a list of numbers such as 1, 2, 3.5 and you want to convert them to a time format, for example 1:00:00, 2:00:00 or 3:30 AM, perform the following steps.
- Divide the numbers by 24 (there are 24 hours in a day). The formula can be as simple as =A2/24.
- Select the cell(s) with the formula result, right-click and select Format Cells from the context menu or press Ctrl+1. Either way, the Format Cells dialog will appear, you select Time on the left pane under Category, and choose the format you want on the right pane under Type. Please see How to format time in Excel for more details.
If your time exceeds 24 hours, 60 minutes, 60 seconds, use these guidelines to correctly show it.
That's all for today. If someone wants to get the first-hand experience with the formulas discussed in this article, you are most welcome to download the sample workbook below.
If you want to learn a few more useful formulas to calculate times in Excel, please check out the related tutorials at the end of this page. I thank you for reading and hope to see you again next week!
Practice workbook for download
Converting time in Excel - examples (.xlsx file)
457 comments
Hello!
I was recently working with a client's required Timesheet. He asked me to add columns to enter time that should be easy for workers. I decided to add two columns and a hidden for the resulted one in format of [h]:mm. The two columns for hrs and mins separately. Then I was to convert the result in AM/PM.
Like, when a worker puts In-Time for 7:00 AM as 7 in one column and 0 in other. But for the Break-Time at 12:00 PM he inputs 12 and 0, and for Restart-Time at 12:30 PM he puts 12 and 30 in the two columns, and then finally Finish-Time for 6:30 PM like 6 and 30 (instead of 18 and 30).
Now I have to add them to the Total hrs they worked. Is there any formula for this to work, please.
Regards
Nadeem Khatri
Hi! To convert two numbers to hours and minutes, use the TIME function. But you cannot automatically convert 6 to 6 PM or 1 to 1 PM. So you need to write the hours in 24 hour format.
How do you convert the below text into an average
1week, 2days, 3hour, 12minutes
1week, 3days, 2hours, 40minutes
And so on
Hi! Split text into cells using these instructions: How to split text string in Excel by comma, space, character or mask. Or you can use the TEXTSPLIT function. For more information, click here: TEXTSPLIT function in Excel: split text strings by delimiter. Then extract numbers from each cell as described here: How to extract number from string in Excel.
Perform the operations with these numbers that you need but that are not clear from your question.
I have a time tracking spreadsheet in excel.
Each row is an activity with a start time and duration
I want to enter whole numbers like 20, 30, 45, 90 for my duration and have excel convert the whole number to h:mm and add it to f22 to be f21
For instance; F22 is my starting time for the day, lets say 8:00, it is formatted as hh:mm
G22 is my duration - currently I must add as 0:20 for 20 minutes and the next start time in F21 is calculated by excel
If I can enter the duration as a whole number, it would save me keystrokes
Hi! If you want to enter minutes as a number instead of time, you can use these instructions to convert that number to time for calculating time: Convert number to time format. Based on your information, the formula might look something like this:
=F22+G22/1440
Dear Sir,
Nice to meet you sir,
I have a data in excel
NNAME G. CHANDRAKANTH
ID NO 5001
DATE SHIFT SHIFT 1
1/Apr/24 IN 9.27
OUT 18.31
2/Apr/24 IN 9.18
OUT 18.30
3/Apr/24 IN 9.22
OUT 18.32
4/Apr/24 IN 9.19
OUT 18.28
5/Apr/24 IN 9.26
OUT 18.18
6/Apr/24 IN 9.18
OUT 18.33
This data need to convert in time mode how can i do this problem please guide me sir
Thanking you
Hi! You can extract the last word from a text string using these instructions: Excel: how to extract first and last word from cell. Replace "." with ":" using the SUBSTITUTE function. Convert this text to time using the TIMEVALUE function and the recommendations from the article above. Here is an example formula:
=TIMEVALUE(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2))),".",":"))
Thanks a lot Sir, it is working very well.
If found any problem i will inform you Sir....
Sir, Thanks a lot for your help,
I tried myself but not succeed.
Can you change only one time for me for my help please.
4 hr. 17 min.10sec.
Hi! What formula did you use? Is this time written as text or as time? If this text, extract all numbers from the text.
The following tutorial should help: How to extract number from string in Excel
Convert these numbers to time using the TIMEVALUE function.
=TIMEVALUE(SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(--MID(H1,ROW($1:$95),1)),MID(H1,ROW($1:$95),1)," ")))," ",":"))
Set the time format you want in the formula cell. Or convert that time to minutes as described in the article above.
If this does not help, explain the problem in detail.
I want to convert this time format into minutes pl, I will be very thankful to you...
13 hr. 59 min.15sec.
Hi! Pay attention to the following paragraph of the article above: How to convert time to minutes in Excel. If this is not what you wanted, please describe the problem in more detail.
Thank you Sir for your reply.
I have a file where is the time is in the format like this format:-
4 hr. 17 min.10sec.
3 hr. 50 min.25sec.
1 hr. 59 min.20sec.
2 hr. 40 min.40sec.
4 hr. 20 min.25sec.
2 hr. 16 min.15sec.
I want to convert into minutes like 150, 140 as please help me.
Hi! I have already answered this question for you. If this is not what you need, please explain why and explain the problem in more detail.
I have a time in excel cell as 03:15 and i want to display in another cell as 3 hours and 15 minutes. How i can convert this. Kindly guide.
Hi! If I understand your task correctly, try to use custom time format:
h "hours and "mm "minutes"
How do I convert text in a cell as 84h 30m into 84.25 as numerical figure? Thank you.
Hi! Extract numbers from the text. Look for the example formulas here: Excel substring functions to extract text from cell. Then combine them using the & operator. For example:
LEFT(A1,2)&"."&MID(A1,5,2)
But I can't guess why you want to convert 30 minutes to 0.25 hours.
I'm trying to convert 28:00:00 to decimal in google sheet but it doesnt work.
Hello Chito,
Please read here: Convert time to decimal in Google spreadsheet
Hello
I want to translate a time written as a whole number to a time value. For example, i want to input a value like "1900" for 19:00 and "530" for 05:30 . Can you please help me translate these values into a time value and all in the same cell ?
Thank you for the help
Hi! You want to automatically change the value you enter in a cell. This can be done using a VBA macro.
How about an integer indicating a duration in minutes, converted to HH:MM?
Hi! Please re-check the article above since it covers your case. Divide this number by 1440 and apply the time format [h]:mm:ss. How to show the time more than 24 hours, read this article.
Very basic, it has been a long day. I know to show .75 in 60 minute hour is .75*.6 = .354 minutes in a 60 minute hour.
What formulae do I use to convert hours worked. i.e. 6.088 so that it shows 6 hrs 52mins
Is there a way?
Hi! I don't really understand why 6.088 should mean 6 hrs 52mins. To convert the number of hours to time, read the last paragraph of the article above.
Alex,
I have over 2500 records. I used the formula above to calculate the difference in dates, converted to days (=F3-$C$3).
Converted time (Sep 27, 2023 07:04 PM) - Created time (Sep 25, 2023 08:32 AM) and have the answer of 2.44 which is great.
However, when I try to click and drag, the first part of the formula changes, but not the second. Dragging from (=F3-$C$3), looking for (=F4-$C$4) but getting (=F4-$C$3).
I have tried to do multiple cells (up to 10) but get the same type of result (=F14-$C$4), (=F15-$C$5). where the second part of the formula just repeats the previously highlighted fields, instead of updating similar to the first part of the formula.
If you could help, it would be greatly appreciated.
Hi! If you want the cell reference to change when you copy a formula, use a relative cell reference. $C$3 is an absolute reference.
Hi Alex, - i have used the formula =MOD(G192-F192,1)*24 to make the total working hours - his total working time came as 12.32, but actual calculation as per the time is he worked for 12 hrs and 19 min, pls suggest the formula what i can use the round down below 25 minutes and round up 25 minutes as an .30 minutes and above 45 minutes 1 hour in single formula.
12.32 is the time 12 hrs and 19 min, written as a decimal number. You can read about this in the article above. To get the number of minutes, use the MINUTE function. Use the rounding functions to round the time up or down. For example,
=IF(MINUTE(A1)<25, FLOOR(A1,"1:00"), IF(MINUTE(A1)<45, FLOOR(A1,"0:30"), CEILING(A1,"1:00")))
02:59:18
03:59:18
04:11:00
04:33:13
05:01:56
05:01:58
i can pivot table. But i didn't proper result in pivot table. I have drag time column to column in pivot table. it's show time only. but i need Hour,Minutes .
Pivot table properly working: i have select time column any one cell i have click f2 + Enter key for all time column cell it's will be working...
please help me for the issue
Sorry, it's not quite clear what you are trying to achieve.
Source I want
7:09:30 7.9
7:02:50 7.2
please help me get this result using excel formula
See the answer in the first paragraph of the article above
Hi,
I want this 176 Hours 06 Mins
In Numbers like - 176.06
Hi! To extract numbers from text and insert a dot between them, try this formula:
=SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(--MID(A1,ROW($1:$95),1)),MID(A1,ROW($1:$95),1)," ")))," ",".")
Hi, would everyone know how to conver this time stamp from SAP business objects report?
"Updated
Time"
102752
103343
114240
120446
125726
143743
144708
145859
150353
155545
160009
160009
I can't guess what result you want to get. I’ll try to offer you the following formula:
=TIME(LEFT(A1,2),MID(A1,3,2),RIGHT(A1,2))
Hello
Am trying to convert hours in this format 150:00:00 to format 150 ,is it possible or it can only be done manually?
Hi! Above in the article it is written that to convert hours into numbers, you must multiply by 24. Read it carefully.