Convert Number to Time in Excel (All Things to Know)

Get FREE Advanced Excel Exercises with Solutions!

This context will cover many essential topics on converting numbers to time in Excel. We will walk you through applying format cells and using various functions. You will also learn to use VBA to convert number to time in Excel.

Converting numbers to time lets you track time by changing hours, minutes, or seconds into a time format. Converting numbers to time is particularly useful for scheduling, planning, and analyzing time-based data.

After reviewing the article, you will have valuable skills and knowledge to work with time-related data. So, let’s dive in.

Convert number to time in Excel using TEXT function

Download Practice Workbook

You can download the practice workbook by clicking the link below.


How to Convert Number to Time Format in Excel

Method 1: Use Format Cells Window

Select cell C5 >> apply the formula below >> drag the Fill Handle icon to C9.

=B5/24

Apply formula before using Format Cells Window

Select range C5:C9 >> press Ctrl+1 to open the Format Cells window.

Use shortcut to open Format Cells Window

Later, go to Number >> choose Time as category >> select intended Type >> click on OK.

Format Cells Window to Convert Number to Time in Excel

As a result, the output will look like the below one.

Output of using Format Cells Window


Method 2: Use TEXT Function

Choose cell C5 >> insert the following formula >> drag the Fill Handle icon to C9.

=TEXT(B5/24,"hh:mm:ss AM/PM")

Use TEXT Function to convert number to time in excel


Method 3: Use TIME, LEFT, RIGHT and LEN Functions

Select the C5 cell >> apply the following formula >> drag the Fill Handle icon to C9.

=TIME(LEFT(B5,LEN(B5)-2),RIGHT(B5,2),)

Use TIME LEFT RIGHT and LEN Function to convert number to time in excel

Notes

If you try to convert an integer number to time, you may get an #VALUE error.


Method 4: Run Excel VBA Code

Choose the intended sheet >> press Alt+F11 to open VBA Editor.

Use shortcut to open VBE

Later, choose Insert >> and click Module >> insert the following code and RUN.

Sub FormatNumberToAMPM()

    Dim timeRange As Range
    Dim cell As Range
   
    Set timeRange = Range("B5:B9")
   
    timeRange.Copy Destination:=Range("C5:C9")
   
    For Each cell In Range("C5:C9")
        cell.Value = cell.Value / 24
        cell.NumberFormat = "hh:mm:ss AM/PM"
    Next cell
End Sub

Insert intended code in VBE to convert number to time

Thus, the output will be the following.

Output of using Excel VBA


How to Convert Numbers to Time Units in Excel

Select cell C5 >> insert the formula below >> drag the Fill Handle icon to C9.

=TEXT(B5/24,"[h] ""hours,"" m ""minutes, "" s ""seconds""")

Using TEXT Function to convert number to time units

Read More: Convert Number to Time hhmmss in Excel


How to Convert Hours, Minutes and Seconds to Time in Excel

Case 1: Convert Hours to Time

Choose the C5 cell >> input the following formula >> drag the Fill Handle icon to C9.

=B5/24

Insert formula to convert hours to time

Later, select range C5:C9 >> go to Home >> extend the Down-arrow >> choose Time.

Convert hours to time from the Number group in the Home tab

As a result, the output will look like the following.

Output of converting hours to time

Notes

If the Number means hours, you must divide by 24.

Read More: Convert Number to Hours and Minutes in Excel


Case 2: Convert Minutes to Time

Choose C5 >> apply the formula below >> drag the Fill Handle icon to C9.

=B5/1440

Insert formula to convert minutes to time

Next, select C5:C9 >> navigate to tab Home >> choose Time as number format.

Convert minutes to time from the Number group in the Home tab

Finally, the output will be below one.

Output of converting minutes to time

Notes

If the Number means minutes, you must divide by 1440.


Case 3: Convert Seconds to Time

Select the C5 cell >> input the following formula >> drag the Fill Handle icon to C9.

=B5/86400

Insert formula to convert seconds to time

Next, select range C5:C9 >> go to Home >> type Time as number format.

Convert seconds to time from the Number group in the Home tab

Finally, we will see the output like the following.

Output of converting seconds to time

Notes

If the Number means seconds, you must divide by 86400.


How to Convert Time to Hours, Minutes and Seconds in Excel

Choose cell C5 >> input the following formula >> drag the Fill Handle icon to C9.

=B5*24

Convert time to hours in excel

Next, select the D5 cell >> insert the following formula >> drag the Fill Handle icon to D9.

=B5*1440

Convert time to minutes in excel

Now, choose E5 >> apply the formula below >> drag the Fill Handle icon to C9.

=B5*86400

Convert time to seconds in excel

Notes

To convert Time to decimals (Hours, Minutes, and Seconds), multiply each unit by 24 for hours, 1440 for minutes, and 86400 for seconds.

Read More: Convert Number to Military Time in Excel


Things to Remember

  • You must save the workbook as macro-enabled, as we have used the VBA code.
  • When converting Hours, Minutes and Seconds to Time, apply the formula first, then format it as General.

Frequently Asked Questions

  • How do you convert numbers into time?

To convert numbers into time format, we mostly use Format Cells. The TEXT function also allows us to convert numbers into time format. The syntax is: =TEXT(A1, “h:mm AM/PM”).

  • How do I convert a number into hours and minutes in Excel?

To convert numbers into hours and minutes, divide the number by 60 to determine the hours. Then, take the remainder and use it as the number of minutes. For instance, if the number is 135, the converted time would be 2:15, indicating 2 hours and 15 minutes.

  • How do I convert text to time in Excel?

We can convert text to time in Excel using the TIMEVALUE function. It takes time_text (the text representation of the time) and returns a decimal number representing the time.


Convert Number to Time in Excel: Knowledge Hub


Conclusion

At this point, you have learned to convert number to time in Excel. We tried to guide you through basic to advanced topics. You have found here various practical aspects related to converting numbers to time. Visit our ExcelDemy site to learn more about the multiple Excel usages. You can also submit your Excel problem to our ExcelDemy Forum.


<< Go Back to Time Conversion | Date-Time in Excel | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Lutfor Rahman Shimanto
Lutfor Rahman Shimanto

Lutfor Rahman Shimanto, BSc, Information Technology, Jahangirnagar University, Bangladesh, has worked with the ExcelDemy project for over a year. He has written 50+ articles and provided solutions of 100+ comments for ExcelDemy. Currently, he works as an Excel & VBA Developer and provides support and solutions in the ExcelDemy Forum. He has solved 100+ ExcelDemy Forum problems. His work and learning interests are in developing various Excel & VBA and Desktop applications. Outside of work, he enjoys Chess... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo