# How to Calculate Hours Between Two Times in Excel (6 Methods)

## Method 1 – Calculating Hours Between Two Times by Subtracting Them in Excel

Weâ€™ve created the following data table to calculate the hours between two times in Excel. The table consists of 3 columns. The first column contains the starting time, the second column contains the ending time, and the third column contains the total hours.

Steps:

• Insert the following formula in cell D5:
`=C5-B5`
• Press the Enter key.
• Drag the Fill Handle icon to the end of the Total Hours column.

## Method 2 – Using the HOUR Function to Compute Hours Between Two Times in Excel

Steps:

• Select cell D5 to insert the following formula:
`=HOUR(C5-B5)`
• Hit Enter.
• Drag the Fill Handle icon to the end of the Total Hours column.

## Method 3 – Using the TEXT Function to Calculate Hours Between Two Times in Excel

Steps:

• Input the following formula in cell D5:
`=TEXT(C5-B5, "h")`
• Press Enter.
• Drag the Fill Handle icon to the end of the Total Hours column.

## Method 4 – Calculating Hours Between Two Different Dates in Excel

Steps:

• Insert the formula below within cell D5.
`=INT((C5-B5)*24)`
• Hit EnterÂ and drag the Fill Handle icon to the end of the third column of the data table.

Note: The number format of the result column has to be General.

## Method 5 – Using the IF Function to Calculate Hours Between Two Times in Excel

This method eliminates negative values by always subtracting the earlier time from the later one.

Steps:

• Insert the formula below in cell D5.
`=IF(C5>B5,C5-B5,1-B5+C5)`
• Press EnterÂ and drag the Fill Handle icon to the end of the Total Hours column.

## Method 6 – Counting Elapsed Time in Hours from a Starting Time to Now

Steps:

• Enter the following formula in cell D5.
`=TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW())) -B5`
• Hit Enter.
• Drag the Fill Handle icon to the end of the Total Hours column.

Formula Breakdown

• HOUR(NOW() â–¶ returns the current hour of time.
• MINUTE(NOW() â–¶ returns the present minute.
• SECOND(NOW() â–¶ returns the current second of time.
• TIME(HOUR(NOW()),MINUTE(NOW()),SECOND(NOW())) â–¶ constitutes standard time formula of the current time.

## Things to Remember

If a cell doesnâ€™t have enough space to show the entire time value, Excel returns ####. Adjust the cell width to fix the issue.

## Related Articles

<< Go Back to Calculate Hours | Calculate Time | Date-Time in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Mrinmoy Roy

Mrinmoy Roy, a dedicated professional with a BSc in Electronics and Communication Engineering from Khulna University of Engineering & Technology, Bangladesh, brings over two years of expertise to the ExcelDemy project. As a prolific contributor, he has authored around 180 articles, showcasing his deep knowledge and passion for Microsoft Excel, Data Analysis, and VBA. His unwavering commitment to continuous learning, combined with versatile skills, renders him well-suited for roles in data management and spreadsheet solutions. He has interest... Read Full Bio