Remove spaces and hyphens from a TIN

Turn 01 - 2345678 into the nine digits 012345678. Leading zeros stay.

What you'll make

In Excel: 01 - 2345678 becomes 012345678.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1A8The TIN, with spaces and a hyphen."01 - 2345678"
2SUBSTITUTE( … "-" … )Takes out every hyphen."01 2345678"
3SUBSTITUTE( … " " … )Takes out every ordinary space."012345678"
4SUBSTITUTE( … 160 … )Takes out nonbreaking spaces, which look like spaces."012345678"

Each bracket wraps the one inside it, so Excel works from the inside out. The TINs here are made-up.

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A8,"-","")," ",""),UNICHAR(160),"")

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 IDs. Paste TINs into the green column of the Template tab. The digits fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

Use this only on TINs you have checked. Other marks stay, so look over any result that isn't nine digits.

Microsoft's help: SUBSTITUTE function