Clean hidden spaces and tabs in times

Turn clock text with nonbreaking spaces or tabs, like 6:45 PM from an export, into a real time.

What you'll make

In Excel: 2:30:15[nonbreaking space]PM becomes 2:30:15 PM.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1A8The clock text. » marks a tab."2:30:15 PM"
2SUBSTITUTE( … 160 … )Swaps each nonbreaking space for an ordinary one."2:30:15 PM"
3SUBSTITUTE( … 9 … )Swaps each tab for an ordinary space."2:30:15 PM"
4TRIM( … )Removes extra spaces at the ends and between."2:30:15 PM"
5TIMEVALUE( … )Turns the text into a real time.2:30:15 PM

Each bracket wraps the one above it, so Excel works from the inside out. A nonbreaking space looks like a space.

=TIMEVALUE(TRIM(SUBSTITUTE(SUBSTITUTE(A8,UNICHAR(160)," "),CHAR(9)," ")))

How to use it

Yellow bar at the top? Click Enable Editing.

  1. See it work. The Example tab shows 20 made-up examples with the formula already in.
  2. Use your own times. Paste clock text like 6:45 PM into the green column of the Template tab. The times fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

This fixes nonbreaking spaces and tabs only. If a row turns amber, it may hide a different odd character.

Microsoft's help: SUBSTITUTE function