Excel’s time-only feature lets you isolate just the time from a cell containing a date and time, saving manual copying or parsing. This is useful for scheduling, reporting, or filtering data where only the time matters—no need to remove the date entirely. No extra software is required, and the methods range from built-in formulas to basic VBA. The simplest approach is the `TIME` function or `MOD` trick, while VBA gives full control for bulk operations.
What You'll Need
- A PC running Microsoft Excel (Desktop or Excel Online)
- Basic familiarity with Excel formulas or VBA (if using custom scripts)
- For VBA, an Excel environment with macro support enabled
Step-by-Step
-
Use the `MOD` formula (no date removal needed):
In a new cell, enter:
=MOD(A1,1)(Replace A1 with your date/time cell.) This returns only the fractional part of the day, which is the time in 24-hour format (e.g., 0.5 = 12:00 PM). For 12-hour display: Add a second formula like=TEXT(MOD(A1,1), "hh:mm:ss"). -
Use the `TIME` function (explicit time extraction):
Break the cell into date and time components by splitting the cell:
=TEXT(A1,"yyyy-mm-dd")+TIME(0,0,0)then isolate time with=TEXT(SUBTOTAL(104,A1),"hh:mm:ss"). Note: Works in Excel 2016+ (104 = sum of non-blank rows). -
Split manually (for one cell):
Highlight your date/time cell, press
Ctrl+;to insert a separator, then:- Double-click the separator to split into three columns: date, time, and residual.
- Copy the time column and paste elsewhere.
-
Use VBA for bulk extraction (recommended for large datasets):
- Press
Alt+F11to open the VBA editor. Go toInsert>Module. - Paste this code:
Sub ExtractTimeOnly() Dim ws As Worksheet Set ws = ActiveSheet Dim rng As Range Set rng = ws.Range("A1:A100") 'Change range to your data Dim cell As Range For Each cell In rng If IsDate(cell.Value) Then cell.Value = Mid(cell.Value, 11, Len(cell.Value) - 10) 'Extracts time End If Next cell End Sub - Run the macro (click the
Runbutton or pressF5).
DateSerialandHourfunctions to isolate time by year/month/day. - Press
Common Mistakes
- MOD issues: If Excel shows time as "0.0" (e.g., 01/01/2023 00:00:00), your cell is formatted as a date-first string. Use
=MOD(IFERROR(VALUE(A1),0),1)to handle mixed formats. - VBA errors: The manual split method fails if the date is stored as text without separators. Always verify data type with
IsDate. - 12-hour vs. 24-hour: The `MOD` and `TIME` formulas return 24-hour time. For 12-hour, use
TEXT(MOD(A1,1),"hh:mm")with a conditional check for AM/PM.
Tips
- For Excel Online, use the same formulas but note that
SUBTOTAL(104) won’t work—rely on the `MOD` or manual split. - Combine with
NOW()to pull the current time:=NOW()-A1gives time elapsed since the cell value. - Use
IFERRORto avoid crashes if a cell is empty:=IFERROR(MOD(A1,1),"No data") - To preserve formatting (e.g., 12-hour time), apply a custom number format like
"hh:mm:ss AM/PM"after extraction.
Troubleshooting
-
Formula not working?
Check if your cell contains a date (not text). If it’s "Jan 1, 2023," try converting to proper date format first:
=DATEVALUE(A1)then apply the extraction method. -
VBA doesn’t run?
Enable macros in Excel: Go to
File > Options > Trust Center > Trust Center Settings > Macro Settings, then selectEnable all macros. -
Extracting time from nested functions?
Use
=TEXT(LEFT(A1,10),"yyyy-mm-dd")+TEXT(MID(A1,12,"hh:mm:ss"),"hh:mm:ss")if the date is concatenated as text. -
Outcome is zero?
Ensure the cell has a valid time component. Test with a known date like
A1=DATE(2023,1,15,14,30).
Frequently Asked Questions
Why can’t I use this on Excel Online?
Excel Online lacks VBA macros and some advanced functions like SUBTOTAL. Stick to MOD or manual splitting, or use a desktop app for automation.
Will this work if my time is in AM/PM format?
No—these methods assume 24-hour time. For 12-hour, use =TEXT(HOUR(A1),"hh")+TEXT(MINUTE(A1),"mm") with a helper column to convert.
How do I extract time from a cell containing "1/15/2023 2:30 PM"?
First convert to a proper date with =DATEVALUE("1/15/2023")+TIME(0,30,0), then use =TEXT(VALUE(IFERROR(A1,0)),"hh:mm:ss") to extract.
Can I automate this for multiple sheets?
Yes—modify the VBA macro to loop through all sheets: Replace ActiveSheet with Application.Worksheets.
Why does MOD(A1,1) return 0.5 for 12:00 PM?
Because Excel’s internal time is continuous (0.5 = 12/24). To get 12-hour, use =TEXT(MOD(A1,1),"hh:mm")+IF(HOUR(A1)=0,"AM","PM").
Is there a way to extract time without changing the original cell?
Yes—copy the value to a new cell or use =TIME(HOUR(A1),MINUTE(A1),SECOND(A1)) if the time is present separately.