DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

How to Calculate the Difference Between Two Dates and Times in Excel

Use =B2-A2 for elapsed time between Excel date-time values. Learn how to display cumulative hours, handle midnight, and calculate total hours or minutes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To find the elapsed time between two date-and-time values in Excel, subtract the start value from the end value—for example, =B2-A2. Format the result as [h]:mm to show total hours and minutes, including durations longer than 24 hours. If you need a numeric total, multiply the difference by 24 for hours, 1,440 for minutes, or 86,400 for seconds.

Calculate elapsed time between two date-time values

Put the start date and time in one cell and the end date and time in another. If the start is in A2 and the end is in B2, enter this in the result cell:

As an Amazon Associate I earn from qualifying purchases.

=B2-A2

Excel stores dates as sequential serial values and times as fractions of a day, so subtracting the earlier value from the later one returns the elapsed duration. This is Microsoft’s documented approach for date-and-time differences: calculate the difference between two dates.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Show hours and minutes

A new result may appear as a decimal because Excel is displaying the underlying fraction of a day. Apply a duration format to the result cell. In desktop Excel, select the cell, open Format Cells, choose Custom, and enter [h]:mm. Use [h]:mm:ss if seconds matter. Microsoft identifies [h]:mm as an elapsed-time format: format numbers as dates or times.

#1 Best Overall
Small Glass Desktop Whiteboard Dry-Erase-Board - Computer Keyboard Stand with Calculator White Board Surface Pad with Drawer, Desk Organizers with Accessories for Office, Home, School Supplies - Black
  • PERFECT DESIGN: Maximize your work area. The desktop whiteboard is designed to sit perfectly between a keyboard and monitor and is slope angled for comfortable reading and writing, or typing when you are using it as a keyboard stand.
  • CONVENIENT REMOVABLE BASIC CALCULATOR - TSJ OFFICE desktop glass whiteboard with removable calculator is a great creative booster for your home & office. Upgraded 12-digit standard function calculator with LCD display is also great for homework. Detachable design allows you to use it freely in any occasion.
  • SMOOTH WRITING & EASY TO WIPE: TSJ OFFICE mini desktop computer pad comes with a smooth and durable temple glass dry erase writing surface. This white board allows you to write and wipes clean with ease over and over. Our easel whiteboard always stays white and easy to read.
  • HIDDEN STORAGE & PAD/MOBILE TRAY: De-clutter your desk by storing markers, magnetic eraser and other desktop accessories in the opening drawer or place markers on the accessory tray for quick access. And one more long tray on the top of the dry erase white board for your pad or mobile.
  • CONTAINS EVERYTHING YOU NEED - This small glass whiteboard kit includes a W 15.8 " x D 7.1 " x H 1.9 " Desktop glass whiteboard, 4 markers and 1 eraser and A 12-digit standard function calculator. It comes with everything you need. Enjoy the standing whiteboard as soon as you receive it!

The square brackets let hours accumulate beyond 24. By contrast, h:mm displays the hour within a clock day, so a duration longer than a day can appear to wrap rather than show its full total.

Return a numeric total in hours

For decimal hours, multiply the date-time difference by 24:

Rank #2
Varhomax Glass Desk Whiteboard Gray with Calculator
  • Removable Calculator: This desk glass white board with removale calculator is an excellent creativity booster for your daily office. The upgraded 12 digit standard functional calculator with LCD display is also an aultimate tool for homework
  • Stylish Desk Organier: Our modern and elegant glass whiteboard adds a touch of simplicity and luxury to your desktop. As a perfect alternative to sticky notes and scratch paper, you can jot down anything and keep track with this desk notepad
  • Smooth Writing and Erasing: This desk whiteboard with 4mm thick tempered glass surface, which allows you write without shadow, no ghosting and can be wiped clean with ease by eraser or paper without stain
  • Built-in Storage: More than a desktop whiteboard for task management, daily to-dos and reminders , the large storage caddy base helps you declutter your supplies and keep your desk neat and tidy
  • Multi-functional Design: Sitting compactly between your monitor and keyboard, you can use it as a desk to do list whiteboard, or phone charger, or phone/tablet holder, or keyboard stand. It can used for your office task organization, family schedule and workout plan

=(B2-A2)*24

For example, 31 hours and 30 minutes equals 31.5 decimal hours. The value is numeric, so it can be used in further calculations. The same multiplication-by-24 method is included in Microsoft’s guidance for adding or subtracting time: add or subtract time.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a formula for the result you need

What you need Formula How to read the result
Elapsed hours and minutes =B2-A2 Format the result as [h]:mm.
Elapsed hours, minutes, and seconds =B2-A2 Format the result as [h]:mm:ss.
Total decimal hours =(B2-A2)*24 A numeric total, such as 31.5 hours.
Total minutes =(B2-A2)*1440 A numeric total of elapsed minutes.
Total seconds =(B2-A2)*86400 A numeric total of elapsed seconds.

Microsoft documents the minute and second conversions, as well as the limits of the component functions, in its guidance on calculating time: calculate time in Excel.

Rank #3
TOWON Glass Desk Whiteboard with Calculator 17x6 in, Desk Organizer, Black
  • MODERN SLEEK DESIGN: Slope desktop whiteboard is ergonomic. Basic calculator, hidden compartments, pad/mobile, marker Tray, providing a smart storage & writing solution
  • GLASS SURFACE: Desktop dry erase white board comes with a smooth and durable temple glass dry erase writing surface. Smooth and erases clean
  • FUNCTION INTRODUCTION: Tablet/Phone and pen holder at the top. Calculate conveniently. For use with keyboard and monitor desk set. Multiple internal storage spaces
  • IDEAL GIFT: Memo board fits in perfectly with any home, office or classroom setting, better organization, teaching and learning without paper large wasting
  • WHAT'S INCLUDED: Board measures 17" x 6" and comes with 2 dry-erase markers and a double-sided eraser. You can insert the marker into the upper pen hole or the inner storage box

Handle time-only entries and intervals that cross midnight

Times on the same date

If both cells contain times on the same date and the end time is later, subtract them as usual—for example, =B2-A2. Format the result as h:mm or h:mm:ss. You can also use =TEXT(B2-A2,"h:mm") for a formatted display, but TEXT returns text rather than a numeric duration, so the result is less useful in later arithmetic.

Overnight interval with time-only values

Time-only entries do not say which date a clock time belongs to. If A2 is 10:00 PM and B2 is 6:00 AM, plain subtraction produces a negative result because Excel has no indication that B2 is on the following day.

Rank #4
Calculator Stand for Desk, 2 Pair
  • 2 Pair Black & Silver Complete Set: This set includes 2 pairs of calculator stands (1 black pair + 1 silver pair), made of sturdy aluminum alloy for long-lasting daily use
  • Stable Desk Calculator Support: Designed as a reliable calculator stand, it elevates calculators to a comfortable angle, reducing wrist strain during daily use
  • Convenient Organizer for Desktops: It functions as a practical calculator holder that keeps calculators upright and accessible, helping maintain tidy workspaces
  • Ideal for Classroom & Office Use: This practical calculator holder for classroom supports standard desktop calculators, perfect for teachers, students, and office workers
  • Non-Slip & Durable Construction: Featuring a stable base and strong adhesive, this calculator stand for desk stays securely in place without slipping or damaging surfaces

If the interval is known to be less than 24 hours, this formula adjusts for a midnight crossing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

=MOD(B2-A2,1)

It returns the next-day difference for that under-24-hour case. It is not suitable when the intended elapsed time may be 24 hours or longer, because time-only values contain no date information to distinguish those durations.

Best Value
Small Glass Desktop Whiteboard Dry-Erase-Board - Computer Keyboard Stand with Calculator White Board Surface Pad with Drawer, Desk Organizers with Accessories for Office, Home, School Supplies - Grey
  • PERFECT DESIGN: Maximize your work area. The desktop whiteboard is designed to sit perfectly between a keyboard and monitor and is slope angled for comfortable reading and writing, or typing when you are using it as a keyboard stand.
  • CONVENIENT REMOVABLE BASIC CALCULATOR - TSJ OFFICE desktop glass whiteboard with removable calculator is a great creative booster for your home & office. Upgraded 12-digit standard function calculator with LCD display is also great for homework. Detachable design allows you to use it freely in any occasion.
  • SMOOTH WRITING & EASY TO WIPE: TSJ OFFICE mini desktop computer pad comes with a smooth and durable temple glass dry erase writing surface. This white board allows you to write and wipes clean with ease over and over. Our easel whiteboard always stays white and easy to read.
  • HIDDEN STORAGE & PAD/MOBILE TRAY: De-clutter your desk by storing markers, magnetic eraser and other desktop accessories in the opening drawer or place markers on the accessory tray for quick access. And one more long tray on the top of the dry erase white board for your pad or mobile.
  • CONTAINS EVERYTHING YOU NEED - This small glass whiteboard kit includes a W 15.8 " x D 7.1 " x H 1.9 " Desktop glass whiteboard, 4 markers and 1 eraser and A 12-digit standard function calculator. It comes with everything you need. Enjoy the standing whiteboard as soon as you receive it!

Overnight or multi-day interval with dates

For overnight, multi-day, or otherwise date-sensitive intervals, enter a complete date and time in both cells. Make the end value’s date the actual later date, then use =B2-A2. This preserves the day relationship and allows Excel to calculate durations longer than 24 hours. Format the result as [h]:mm or [h]:mm:ss for a cumulative display.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Calculate calendar days, months, or years instead

Elapsed-time subtraction answers how much time passed. If you need whole calendar units between dates—rather than hours and minutes—Microsoft documents the DATEDIF function:

  • =DATEDIF(A2,B2,"d") returns the number of days.
  • =DATEDIF(A2,B2,"m") returns the number of complete months.
  • =DATEDIF(A2,B2,"y") returns the number of complete years.
  • =DATEDIF(A2,B2,"ym") returns remaining months after complete years.
  • =DATEDIF(A2,B2,"yd") returns remaining days after complete years.

These are calendar-unit calculations, not substitutes for a timestamp duration such as total hours. Microsoft’s DATEDIF function documentation says the function is retained for compatibility with older Lotus 1-2-3 workbooks, warns that it can calculate incorrectly in some scenarios, and does not recommend the "md" unit because of known limitations. The start date must precede the end date; a reversed range can return #NUM!.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix common date-and-time difference problems

  • The answer is a decimal: The subtraction may be correct; the cell is showing the raw serial fraction. Apply [h]:mm or another appropriate duration format.
  • The displayed total wraps after 24 hours: Change h:mm to [h]:mm so elapsed hours accumulate.
  • An overnight result is negative: Use full date-time values with the end on the following date. Use MOD only for a known interval shorter than 24 hours.
  • HOUR, MINUTE, or SECOND gives too small a total: These functions return components, not unrestricted cumulative totals. For total hours, minutes, or seconds, multiply the serial difference by 24, 1,440, or 86,400.
  • DATEDIF returns an error or unexpected result: Check that the start date precedes the end date, and avoid the "md" unit. Microsoft also cautions that DATEDIF may be inaccurate in some situations.
  • Excel interprets a date unexpectedly: Enter a date format recognized by the workbook’s locale, or construct the date with DATE(year,month,day) rather than relying on ambiguous text.

Formatting in Excel for the web

Microsoft’s guidance says Excel for the web can add and subtract values totaling more than 24 hours, but the described web workflow cannot apply a custom number format. If you need the cumulative [h]:mm display and cannot set it in the web version, use desktop Excel for the formatting step or display a numeric total such as =(B2-A2)*24. The limitation is specific to the cited workflow; it should not be read as a claim that web Excel cannot calculate the duration.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.