It’s 8:13 AM on a Monday. You’re pasting last night’s shift handoff log into your master AM schedule — Sarah Chen’s 6:00 AM start time just turned into 6:00 PM. Again. Your team’s already missed two deliveries because Excel misread '6:00 AM' as 18:00.
The Problem
Excel doesn’t store 'AM' or 'PM' as text when you enter times — it converts them instantly to 24-hour decimal values. But if your source data is inconsistent (e.g., some rows use '6:00 AM', others '6:00AM', '6:00 am', or even '6:00 a.m.'), Excel treats those as text — not time values. That breaks sorting, formulas like SUMIFS, and conditional formatting rules built for true time values.
Here’s what your raw AM schedule probably looks like right now — pulled from three different departments, pasted from emails and PDFs:
| Employee | Shift Start | Shift End | Dept |
|---|---|---|---|
| Sarah Chen | 6:00 AM | 2:00 PM | Warehouse |
| Diego Morales | 7:30AM | 3:30PM | Logistics |
| Priya Patel | 8:00 a.m. | 4:00 p.m. | Receiving |
| Marcus Lee | 5:45 AM | 1:45 PM | Loading Dock |
| Aisha Johnson | 6:15am | 2:15pm | Quality Control |
| Tomas Ruiz | 7:00 A.M. | 3:00 P.M. | Dispatch |
| Lena Kim | 6:30 AM | 2:30 PM | Warehouse |
Check column B. Select B2:B8 and look at the formula bar. Only B2 and B7 show true time values (Excel displays them as 6:00:00 AM). The rest? All left-aligned — Excel sees them as text. Try sorting by Shift Start: they’ll sort alphabetically ('5:45 AM', '6:00 AM', '6:15am', '6:30 AM', '7:00 A.M.', '7:30AM', '8:00 a.m.') — not chronologically.
The Solution
You don’t need Power Query or VBA. Just four steps — all native Excel — to convert every variant of AM/PM into a real time value. This works in Excel 2016+, including Excel for Microsoft 365.
- Clean spacing & case: In column D (starting at D2), enter
=SUBSTITUTE(SUBSTITUTE(UPPER(B2)," ",""),".",""). This strips spaces and periods, converts everything to uppercase:6:00AM,7:30AM,8:00AM. - Add colon before AM/PM: In column E (E2), use
=IF(ISNUMBER(FIND("AM",D2)),SUBSTITUTE(D2,"AM",":00 AM"),SUBSTITUTE(D2,"PM",":00 PM")). This forces consistent format:6:00:00 AM. - Convert to time: In column F (F2), use
=TIMEVALUE(E2). This returns Excel’s decimal time value (e.g., 0.25 for 6:00 AM). - Format & replace: Select F2:F8 → Right-click → Format Cells → Category: Time → Type: 1:30 PM. Then copy F2:F8 → Paste Special → Values only → Paste over B2:B8.
That last step is critical — and where most people get stuck. You can’t just paste formulas over the originals and expect Excel to keep formatting. You must paste values *first*, then reapply time formatting.
Here’s your cleaned AM schedule — now fully sortable, filterable, and formula-ready:
| Employee | Shift Start | Shift End | Dept |
|---|---|---|---|
| Marcus Lee | 5:45 AM | 1:45 PM | Loading Dock |
| Sarah Chen | 6:00 AM | 2:00 PM | Warehouse |
| Lena Kim | 6:30 AM | 2:30 PM | Warehouse |
| Aisha Johnson | 6:15 AM | 2:15 PM | Quality Control |
| Diego Morales | 7:30 AM | 3:30 PM | Logistics |
| Tomas Ruiz | 7:00 AM | 3:00 PM | Dispatch |
| Priya Patel | 8:00 AM | 4:00 PM | Receiving |
Now try sorting by Shift Start. It works — no more 8:00 AM appearing before 6:15 AM.
Going Further
Once your AM schedule is clean, you can build useful downstream logic:
- To flag shifts starting before 6:30 AM:
=IF(B2 - To calculate shift length in hours:
=MOD(C2-B2,1)*24in column H (handles overnight shifts correctly). - To auto-highlight AM-only shifts (ending before 12:00 PM): Use Conditional Formatting → New Rule →
=C2 - If your data includes dates too (e.g.,
2024-03-15 6:00 AM), skip steps 1–2 above and use=--SUBSTITUTE(SUBSTITUTE(A2," ","",1),".","")— the double-unary forces conversion without TIMEVALUE.
Surprising tip: Excel’s TIMEVALUE() function ignores extra spaces *only* when AM/PM is uppercase and adjacent to the time. That’s why step 1 (UPPER + SUBSTITUTE) is non-negotiable — lowercase 'am' or 'pm' breaks it silently.
When NOT to Use This
This method fails in three specific cases — and you’ll know immediately:
- Mixed date-time entries: If your raw data contains full timestamps like
3/15/2024 6:00 AM, don’t use TIMEVALUE alone. It will return #VALUE! unless you first extract the time portion using=TIMEVALUE(RIGHT(A2,LEN(A2)-FIND(" ",A2))). - 24-hour clock inputs: If some rows say
06:00and others6:00 AM, TIMEVALUE won’t distinguish — both become 0.25. Add a check:=IF(ISNUMBER(FIND(":",B2)),TIMEVALUE(B2),TIMEVALUE(B2&" AM")). - “Midnight” edge cases: Entries like
12:00 AMconvert to 0.0 (midnight), but12:00 PMbecomes 0.5 (noon). That’s correct — but if your team uses00:00or24:00, this method won’t recognize them. Pre-clean those manually.
Also — never run this on live production data without backing up first. TIMEVALUE returns #VALUE! for any unrecognized string, and if you paste values over originals before verifying, you’ll lose the original text.
Keyboard Shortcuts
Speed matters when fixing 200+ rows. These Alt sequences cut cleanup time in half:
| Action | Shortcut | Notes |
|---|---|---|
| Open Format Cells dialog | Ctrl + 1 | Then press Alt + H → T → Enter to jump to Time category |
| Paste Special → Values only | Alt + E + S + V + Enter | Hold Alt, press each key in sequence — no delays |
| Auto-fill down (after entering formula in E2) | Ctrl + D | Select E2:E8 first, then press |
| Toggle formula view (to verify TIMEVALUE output) | Ctrl + ` (backtick) | Shows actual decimal values (e.g., 0.25, 0.3125) |