Subtracting hours in Excel can be a bit tricky, but there are several ways to do it. Whether you're working with time sheets, schedules, or simply trying to calculate the duration between two times, Excel has got you covered. In this article, we'll explore five different methods to subtract hours in Excel, including using formulas, formatting, and even VBA macros.
Understanding Time Formats in Excel
Before we dive into the methods, it's essential to understand how Excel handles time formats. By default, Excel stores times as decimal values, where:
- 1 day = 1
- 1 hour = 1/24
- 1 minute = 1/1440
- 1 second = 1/86400
This means that when you enter a time value, Excel converts it into a decimal value behind the scenes. For example, 8:00 AM is equivalent to 0.3333 (8 hours / 24 hours).
Method 1: Using the Subtract Formula
The simplest way to subtract hours in Excel is by using the subtract formula. Suppose you have two time values in cells A1 and B1, and you want to calculate the difference in hours.

Enter the formula: =B1-A1
This will give you the difference in hours. To format the result as hours, select the cell and go to the Number tab in the Home ribbon. Click on the "Custom" category and enter the format code h:mm
.
Method 2: Using the TIME Function
The TIME function is a more flexible way to subtract hours in Excel. This function allows you to specify the hour, minute, and second components separately.

Enter the formula: =TIME(B1-A1,0,0)
This formula subtracts the hour value in cell A1 from the hour value in cell B1, and returns the result as a time value.
Method 3: Using the HOUR Function
The HOUR function extracts the hour component from a time value. You can use this function to subtract hours from a time value.

Enter the formula: =HOUR(B1-A1)
This formula extracts the hour component from the difference between cells B1 and A1.
Method 4: Using VBA Macros
If you need to subtract hours from a large dataset, using VBA macros can be a more efficient way. Create a new module in the Visual Basic Editor and paste the following code:

Sub SubtractHours()
Dim cell As Range
For Each cell In Selection
cell.Value = cell.Value - 1
Next cell
End Sub
This macro subtracts one hour from the selected cells.
Method 5: Using Power Query
If you're using Excel 2016 or later, you can use Power Query to subtract hours from a table.

Go to the Data tab, click on "From Other Sources," and select "Blank Query." Enter the following formula in the formula bar:
=Table.SelectColumns(#"Table1", {"Time"} - #duration(0,1,0,0))
This formula subtracts one hour from the "Time" column.
Gallery of Excel Time Format Images
Excel Time Format Gallery






In conclusion, subtracting hours in Excel can be achieved using various methods, including formulas, formatting, and even VBA macros. By understanding the different methods and techniques, you can choose the best approach for your specific needs. Remember to format your results as hours, and don't hesitate to experiment with different methods to find the one that works best for you.