Get last name from name with comma — Manipulating NAMES in Excel
If you need extract the last name from a full name in LAST, FIRST format, you can do so with a formula that uses the LEFT and FIND functions. The formula works with names in this format, where a comma and space separate the last name from the first name.
Note: this formula will only work with names in Last, First format, separated with a comma and space.
In the example, the active cell contains this formula:
How this formula works
At a high level, this formula uses LEFT to extract characters from the left side of the name. To figure out the number of characters that need to be extracted to get the last name, the formula uses the FIND function to locate the position of “, ” in the name:
FIND(", ",B4) // position of comma
The comma is actually one character beyond the end of the last name, so, to get the true length of the last name, 1 must be subtracted:
FIND(", ",B4)-1 // length of the last name
Because the name is in reverse order (LAST, FIRST), the LEFT function can simply extract the last name directly from the left.
For the example, the name is “Chang, Amy”, the position of the comma is 6. So the formula simplifies to this:
6 – 1 = 5 // length of last name
LEFT("Chang, Amy",5) // "Chang"