Excel Subtract Time to Get Hours Decimal
In this article
Yes, you can subtract time in Excel and display the result as a decimal number of hours. The key is to subtract the start time from the end time, then multiply the result by 24, because Excel stores time as a fraction of a day. For example, if A1 is 9:00 AM and B1 is 5:30 PM, the formula =(B1-A1)*24 returns 8.5, meaning 8.5 hours.
How Excel Stores Time
Excel treats time as a decimal portion of a 24-hour day. One hour equals 1/24 (approximately 0.041667), one minute equals 1/1440, and one second equals 1/86400. When you enter 9:00 AM, Excel stores it as 0.375 (9 divided by 24). This internal representation is why simply subtracting two time values gives a fraction of a day, not hours directly. Multiplying by 24 converts that fraction into hours.
The Basic Subtraction Formula
To get the elapsed time in decimal hours, use this general formula:
=(End_Time - Start_Time) * 24
For example, if you have start time in cell A2 and end time in cell B2, the formula in C2 would be:
=(B2-A2)*24
Format cell C2 as a number with two decimal places (Home → Number Format → Number). If you leave it formatted as time, you’ll see a time value like 8:30 instead of 8.5.
Handling Time That Crosses Midnight
A common problem is when a shift starts at 10:00 PM and ends at 6:00 AM the next day. A direct subtraction =(B2-A2) would return a negative value because Excel doesn't automatically know the end time is on the next day. To handle this, use the MOD function:
=MOD(B2-A2,1)*24
This formula adds 1 (a full day) to the difference if it's negative, then takes the remainder. For 10:00 PM to 6:00 AM, it gives 8.0 hours. If you're using a date and time together (e.g., 2025-01-01 22:00), a simple subtraction works because the date part makes the values larger.
Formatting the Result as a Decimal
After entering the formula, the cell may still show a time format. To change it:
- Select the cell with the formula.
- Press Ctrl+1 (or right-click → Format Cells).
- Go to the Number tab.
- Choose Number and set decimal places (e.g., 2).
Now the cell will display 8.50 instead of 8:30 AM. If you want to show hours and minutes as a decimal (e.g., 8 hours 30 minutes = 8.5), this is the correct format.
Common Mistakes and How to Avoid Them
- Forgetting to multiply by 24 – Without it, you get a fraction of a day (e.g., 0.354) rather than hours.
- Using the wrong cell format – If the result looks like a time (e.g., 8:30), change the number format to Number.
- Negative results for overnight shifts – Use
=MOD(end-start,1)*24to handle crossings. - Entering time as text – If you type “9am” instead of “9:00 AM”, Excel may treat it as text. Use proper time format (e.g., 9:00 AM).
- Not accounting for date changes – If your times include dates, ensure both cells have date and time, or the subtraction may be off.
Converting Decimal Hours to Hours and Minutes
Sometimes you need the result in hours and minutes (e.g., 8.5 hours = 8 hours 30 minutes). To separate them:
=INT((B2-A2)*24) & " hours " & ROUND(((B2-A2)*24 - INT((B2-A2)*24))*60,0) & " minutes"
Or use the TEXT function: =TEXT(B2-A2,"h:mm") to show 8:30. For a numeric value in minutes, multiply by 1440: =(B2-A2)*1440.
Frequently Asked Questions
Why is my result showing as 12:00 AM?
This usually means the cell is formatted as time. The value is correct but displayed as a time. Change the cell format to Number to see the decimal hours.
How do I subtract time across multiple days?
If your start and end times include dates (e.g., 2025-01-01 22:00 and 2025-01-02 06:00), a simple subtraction works because the date part makes the values larger. If you only have times, use =MOD(end-start,1)*24.
Can I subtract time and get hours in Excel for a timesheet?
Yes, that's a common use. Enter start and end times, subtract, multiply by 24, and format as a number. For lunch breaks, subtract the break duration as well: =(end-start-lunch)*24.
What if my times are in text format?
Use =TIMEVALUE(text) to convert text to a time value, then subtract. For example, =(TIMEVALUE("5:30 PM")-TIMEVALUE("9:00 AM"))*24.
How do I handle negative time in Excel?
Excel displays negative times as ##### by default. You can either use the MOD formula to avoid negatives, or change Excel's options to use the 1904 date system (File → Options → Advanced → “Use 1904 date system”), which allows negative time display.
Is there a difference between decimal hours and time format?
Yes. Decimal hours are a plain number (e.g., 8.5), while time format is a fraction of a day (e.g., 8:30 AM). Multiplying by 24 converts the fraction to hours.