Formula to reverse order of name and surname in the same cell
You might get a list with names and surnames stored in the same cell, and you need to reverse their order (from "Name Surname" to "Surname Name"). Most common way to achieve this is through MID/LEFT/RIGHT functions or "Text to Columns" command. But that is only the first step. Next step is to concatenate cells in reverse order.
Here is a formula to get it at once, and it also works with two surnames and two names, separated by space (Caetano Gonzalez) or dash (Mary-Jane).
Assuming your data is in cell A2, type this in B2:
=PROPER(RIGHT(A2;LEN(A2)-FIND(" ";A2)) & ", " & LEFT(A2;FIND(" ";A2)-1)).
Formula finds first space (separating first name from surname), takes everything from that point to the right (surname) and places it at the beginning. Second part of formula takes everything to the left (first name) and places it at the end. Name and surname are separated by space (& " " &). You may want change it to comma-space. Finally, result is an argument of PROPER function, just to get only first letters as capitals.
Look at the attached example file.
Attachment | Size |
---|---|
ReverseNameSurname.xlsx | 8.51 KB |
- Almir's blog
- Login or register to post comments
- 9675 reads
Recent comments
5 years 41 weeks ago
6 years 27 weeks ago
6 years 39 weeks ago
6 years 42 weeks ago
6 years 43 weeks ago
6 years 48 weeks ago
7 years 4 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago
7 years 5 weeks ago