How to convert time to decimal number, hours, minutes or seconds in Excel

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 ).

Convert time to a decimal number in Excel

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)
The formula and arithmetic calculation to convert time to hours in Excel

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:
Converting time to minutes in Excel

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
Converting time to seconds in Excel

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:

  1. 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.
  2. 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)
Use the INT function to extract the date values

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)
Splitting date and time in Excel

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.
Setting up a countdown timer in Excel

The formula to enter in cell D4 is as follows:

=INT(C4) & " days, " & HOUR(C4) & " hours, " & MINUTE(C4) & " minutes and " & SECOND(C4) & " seconds"
The formula to spell time in Excel

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!
The formula to spell time in Excel excluding zero values

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:

TIMEVALUE(time_text)

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
Convert text to time using the Excel TIMEVALUE function

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:
Converting time to text in Excel

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.

  1. Divide the numbers by 24 (there are 24 hours in a day). The formula can be as simple as =A2/24.
  2. 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.

Converting numbers to the time format in Excel

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)

459 comments

  1. Our time is currently entered as 41:30:00 for 41 hours 30 minutes and 0 seconds. I tried using your convert time to hours formulas but I come up with 17.5 which is clearly not correct. Can you tell me what I am doing wrong?

    • Suppose your value is at cell 'A1' then use-
      =INT(A1)*24+HOUR(A1)+MINUTE(A1)/70+SECOND(A1)/3600

  2. Hi there
    I'm trying to convert 0d 1h 6m to a numerical number any chance of helping out I've tried to use a couple of variations to formulas on here but cant seem to get them to work any help would be appreciated.

  3. great tutorial. My question is this. At my job I have to complete so many "points per hour" so if I have A1=7:00 and A2=17:00 and I have completed 72 points, which is located in A3. How would I calculate my points per hour? Thanks in advance

  4. I am looking to do the following:
    - calculate time from two given values, and convert into a decimal *that rounds to set criteria*.
    We use a time calculation where
    0-2min = 0.0
    3-8min = 0.1
    9-14min= 0.2 etc. so the criteria would have to be established.

    Example:
    START: 14:00 STOP: 15:03
    =TIME: 1.1

  5. Hello,
    I have a column for hours, another for minutes and another for seconds:
    Hr Min Sec
    7 15 22
    7 17 25
    7 17 45
    How do I combine these into a single time formatted column?
    Time
    7:15:22am
    7:17:25am
    7:17:45am

    Thanks in advance,
    Brian

    • HI,
      HOW DO I GET 1212 TO 12:12:00??

      • =TEXT(F7,"00\:00")

  6. How do i change the time format from 10:00 into 10+00. (10 is the hr and 00 is the minutes.

    • Hello Karl,

      To change the cell format, do the following. Select the cell(s), press Ctrl+1 to open the Format Cells dialog, on the left-side pane under 'Category' choose Custom, and type the following format in the Type box: hh+mm

  7. Working on a report where I have a measurement of time such as 112:26:56. This time is for the entire month, now how can I covert that time into a decimal?

  8. My data pulls the exact time 00:00:00 format for when I receive a message. I need to combine them by hour so I can see how many messages I get per hour of the day, can you do that?

  9. I Have some problem in Time diff calculation
    office timing 9 to 19 Oclok , How to calculate over time.
    working time 9 to 21.28 min .

    Plz Suggest, In Excel calculation is 3.7 Hrs But actual it Is 3.5 Hrs . ( Converted In Numbers)

    Please suggest Right formula

  10. try this one..I7 is your cell

    =TEXT($I7,"hh:mm")

  11. Hi
    Suppose i have some data in 40:15:00 Hrs, now i want in 40:15 Hrs, so would request you provide the formulas for this.

    Thanks

    • try this one..I7 is your cell

      =TEXT($I7,"hh:mm")

  12. Thank you so much for this valuable effort. Please I need your help in calculating the daily over time as i have 2 column for; "IN" (Hr:Min AM) & "OUT" (Hr:Min PM) and the regular working hours shouldn't be less than 7 Hours started from any time between 7:00 AM to 8:00 AM and finished at anytime between 2:00 PM to 3:00 PM if it is not within the regular range should be deducted from the overtime. Then to color the exceeded time in Cyan
    Thank you so much

  13. Please, suppose I have a particular time stated as 07:23 and I want to convert it to something like this: 07:15-07:30 and convert 08:11 to 08:00-08:15, how do I go about it?

    Thank you

  14. is there a formula to convert a date (MM/DD/YYYY)to a decimal format?

  15. Can we convert the text "2 days 1 hour" or "3 hours 10 mins" to numerical number, measure by mins for example? Thanks.

    • Hello, Chris,

      Please try this formula:
      =IF(ISERROR(FIND("day", A1)), 0, INT(TRIM(LEFT(A1, FIND("day", A1) -1))) * 24 * 60) + IF(ISERROR(FIND("hour", A1)), 0, INT(MID(A1,IF(FIND("hour",A1)-6<0,1,FIND(" ",A1,FIND("hour",A1)-6)),FIND("hour",A1)-IF(FIND("hour",A1)-6<0,1,FIND(" ",A1,FIND("hour",A1)-6)))) * 60) + IF(ISERROR(FIND("min", A1)), 0, INT(MID(A1, FIND(" ", A1, FIND("min", A1)-6), FIND("min", A1)-FIND(" ", A1, FIND("min", A1)-5))))

      • Hello Maria,

        This works perfectly besides in the cases where I am missing the hours in the cell (e.g. in the cell I have only "10 mins". I am not able to figure the issue out myself. Can you please help me?

  16. Great tutorial and so easy to understand and implement.

  17. Hi,

    How can I convert 42.81 into 43.21? I need to round the 42.81 into total of hours and minutes.

    Thanks

    • Hello, Glenn,

      Sorry, we haven't quite understood your task. Could you give more details and examples?

  18. Hi guys,

    Thanks for the solutions you've shared. I found them very helpful, though I am not that 100% sure that I can get them right. I haven't tried yet some of them, and to what my concern is, I didn't find a solution to my problem still despite of all this shared solutions. Could anyone just direct me to a certain solution to my case?

    My question was, how may I convert a given sample/answer (ex: 3days 10hours 35minutes) in a certain cell into a total minutes only (ex: 382719)?

    In other words I just want to simply convert them into total minutes using 1 formula with the given sample above as: 3days 10hours 35minutes

    Many thanks,

    Adzhar

    • Hello, Adzhar,

      Please try the following formula for your task:
      =INT(LEFT(A2; FIND("day"; A2) - 1)) * 24 * 60 + INT(MID(A2; FIND(" "; A2) + 1; FIND("hour"; RIGHT(A2; LEN(A2) - FIND(" "; A2))) - 1)) * 60 + INT(MID(A2;FIND(" ";A2;FIND("hour";A2))+1;FIND("min";A2)-FIND(" ";A2;FIND("hour";A2)) - 1))

  19. How do I return the second value from this number 00:00:24.306? When I use the Second(cell) all I get is 24. When I format the cell for 3 decimal places, I get 24.000. I would like to get 24.306.

    • Hi Scott,

      You can use the TEXT function, for example:
      =TEXT(A1, "ss.000")

      The result of the above formula is a text string. To convert it to a number, you can multiply the returned value by 1, and then format the cell for 3 decimal places:
      =1*TEXT(A1, "ss.000")

      • Hi
        I have a similar problem with pivot tables. I have formatted all cells with "mm:ss,000" , but when the pivot is updated to sum all time cells, it doesn't consider the decimals ...
        My use case is to sum all several time cells on a competition ... therefore decimals are important.
        Can you help ?
        Thanks in advance

  20. nice tutorial

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)