Skip to content

Instantly share code, notes, and snippets.

@prikkprikkprikk
Last active June 15, 2019 09:33
Show Gist options
  • Save prikkprikkprikk/701d45dedc0f43ba075b6cfdc6fc25e8 to your computer and use it in GitHub Desktop.
Save prikkprikkprikk/701d45dedc0f43ba075b6cfdc6fc25e8 to your computer and use it in GitHub Desktop.
Excel: Split names (regardless of number of first and middle names)
These formulas will split names into first and middle names, and last name, respectively.
Alan Bega => Alan / Bega
Alan Brian Carr => Alan Brian / Carr
Alan Brian Cory Dorset => Alan Brian Cory / Dorset
… etc
Extract first and middle names:
= LEFT( B2; SEARCH("#"; SUBSTITUTE(B2;" "; "#"; LEN(B2) − LEN(SUBSTITUTE(B2; " "; "")))) -1 )
Extract last name:
= RIGHT(B2; LEN(B2) − SEARCH("#"; SUBSTITUTE(B2;" "; "#"; LEN(B2) − LEN(SUBSTITUTE(B2; " "; "")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment