Mask all but the last four phone digits

Turn 2015550123 into ******0123 for a short display label.

What you'll make

In Excel: 2015550123 becomes ******0123.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1A8=""Checks if the phone cell is empty.No
2REPT("*",MAX(0,LEN(A8)-4))Writes one * for each digit before the last four."******"
3RIGHT(A8,4)Adds the last four digits as they are."******0123"
4IF( … )Leaves empty rows blank, otherwise uses parts 2 and 3."******0123"

MAX stops the count going below zero. The original cell doesn't change. The numbers here are made-up.

=IF(A8="","",REPT("*",MAX(0,LEN(A8)-4))&RIGHT(A8,4))

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

Before you send

Paste digits only, with no spaces, + or extension. Keep the full numbers safe; this is only a label.

Microsoft's help: REPT function