The easiest way to do this is with the newer TEXTAFTER function.

Both options are explained below.

Note the contrast between the modern solution and the legacy solution.

Excel formula: Get first name from name

TEXTAFTER extracts text that occursaftera given delimiter.

In its simplest form, TEXTAFTER only requires two arguments, text and delimiter.

Normally, a positive instance number tells TEXTAFTER to count instances from the left.

Excel formula: Get middle name from full name

Anegativeinstance number tells TEXTAFTER to count instances from theright.

In other words, we are asking TEXTAFTER for the text after thelastspace.

TEXTAFTER has many other options that you’re able to read .

Excel formula: Split full name into parts

This is a complicated formula.

contains one or more middle names).

At the core, this formula uses theMID functionto extract characters in the name starting at a particular location.

Excel formula: Get first name from name with comma

Once we have that number, we simply add 1 to determine astart_numfor MID.

How does the code replace only thelastspace with an asterisk?

This is the clever part.

Excel formula: Get last name from name with comma

Buckle up, because the explanation gets a bit technical.

The key to this formula is this bit:

Normally, theSUBSTITUTE functionwill replace all instances ofold_textwithnew_text.

If the argument is omitted, all instances are replaced.

Excel formula: Join first and last name

If a number like 2 is provided, SUBSTITUTE will replace only the second instance.

At this point, the problem becomes how to calculate the correctinstance_num.

you might find a more detailed explanationhere.

Excel TEXTAFTER function

We then add 1 to get a starting position of 11.

This is the number used fornin the formula above.

Notice that we providenum_charsas 100.

Excel MID function

This arbitrary number is part of a shortcut with MID.

you might increase this number as needed.

Note: Extra spaces in the names will cause problems with the formulas on this page.

Excel LEN function

For example, =MID(“apple”,2,3) returns “ppl”.

LEN will also count characters in numbers, but number formatting is not included.

SUBSTITUTE Function

The Excel SUBSTITUTE function replaces text in a given string by matching.

Excel SUBSTITUTE function

When the text is not found, FIND returns a #VALUE error.

Excel FIND function