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:
In the example, the active cell contains this formula:
Here’s how the 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 “Dominic, Johanson”, the position of the comma is 8. So the formula simplifies to this:
8 – 1 = 7 // length of last name
LEFT("Dominic, Johanson",7) // "Dominic"
Note: this formula will only work with names in Last, First format, separated with a comma and space.