Build a labeled NPI and TIN line

Write NPI: 1234567890 | TIN: 012345678, skipping a missing one.

What you'll make

In Excel: 1234567890 + 012345678 becomes NPI: 1234567890 | TIN: 012345678.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1IF(A8="",…,"NPI: "&A8)Writes NPI: and the NPI, if there is one."NPI: 1234567890"
2IF(B8="",…,"TIN: "&B8)Writes TIN: and the TIN, if there is one."TIN: 012345678"
3TEXTJOIN( … )Joins them with a bar and skips empty ones."NPI: … | TIN: …"

The " | " and TRUE inside TEXTJOIN mean: a bar between, skip empty parts. The IDs here are made-up.

=TEXTJOIN(" | ",TRUE,IF(A8="","","NPI: "&A8),IF(B8="","","TIN: "&B8))

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 NPIs and TINs, stored as text, into the green columns of the Template tab. Leave a cell empty when there isn't one.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

Check and format each ID before you paste it. The formula only adds labels, it doesn't fix the digits.

Microsoft's help: TEXTJOIN function