1TEXTAFTER and TEXTBEFORE
=TEXTAFTER(A2,", ")&" "&TEXTBEFORE(A2,", ")
- In B2 type =TEXTAFTER(A2,", ")&" "&TEXTBEFORE(A2,", ") to turn "Nair, Priya" into "Priya Nair".
- For the opposite direction use =TEXTAFTER(C2," ")&", "&TEXTBEFORE(C2," ").
Turn "Last, First" into "First Last" and back again with TEXTBEFORE and TEXTAFTER, or with MID and FIND in any version.
A system exports names as "Nair, Priya" and your mail merge wants "Priya Nair". Or the other way round: you have "Priya Nair" and a sorted list needs "Nair, Priya".
Both directions work the same way: cut the name at the separator, then join the two pieces in the opposite order.
For "Last, First", the separator is a comma and a space:
=TEXTAFTER(A2, ", ") & " " & TEXTBEFORE(A2, ", ")
TEXTAFTER returns what follows the separator, which is the first name. TEXTBEFORE returns what precedes it, the last name. The ampersand joins them with a space between.
For "First Last", cut at the space and put a comma between: =TEXTAFTER(C2, " ") & ", " & TEXTBEFORE(C2, " ").
In versions before Microsoft 365, use MID, LEFT and FIND. FIND returns the position of the comma, and the pieces are cut from there: =MID(A2, FIND(", ", A2)+2, 100) & " " & LEFT(A2, FIND(",", A2)-1).
Watch for names that do not follow the pattern. A name with no comma returns #N/A from TEXTAFTER and TEXTBEFORE, which you can catch with IFERROR and return the original name. Names with suffixes such as Jr., or with several words in the surname, will split at the first separator and may need a manual check.
If you only need to do this once, Flash Fill can learn it: type the first result by hand beside the data, then choose Data > Flash Fill or press Ctrl+E. It writes fixed text. The Logic and text track practises splitting and joining.
=TEXTAFTER(A2,", ")&" "&TEXTBEFORE(A2,", ")
=MID(A2,FIND(", ",A2)+2,100)&" "&LEFT(A2,FIND(",",A2)-1)
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In B2, turn the name in A2 from Last, First into First Last. Fill down to B8.
Answer in B2, then it fills down to B8.
Logic and text covers this in lesson 11, MID and FIND.