Jan 09


Today I had a list of full names (eg “Ed Smith”) in a Numbers spreadsheet. I wanted to separate  it into first and last name to be able to sort if alphabetically. It was harder than it should be – in my opinion Apple should have a firstname and lastname function!  But they don’t. So here’s how to get first name and last name.

After you’ve done this if you want to delete the original full names you’ll need to ‘copy’ then ‘paste values’ over the formula.

The Original full name is in the cell ‘B2’


=LEFT(B2,(SEARCH(" ",B2)-1))


=MID(B2,(SEARCH(" ",B2)+1),20)
The LEFT function takes the first digits of the cell, up until a certain point.
The SEARCH function looks for a space ” “.
So the Firstname function I made above is just taking all the letters up until the first space. It needs a ‘-1’ in the formula or else it would take the space as well.

The MID function grabs all the letters from a certain point on.
So this takes the next 20 letters after the space. (The +1 means start after the space).


Update: Middlename
OK, in reply to a question below, which I took as a challenge, here’s how to extract a middle name:

MID(B2,(SEARCH(" ",B2)+1),(((SEARCH(" ",B2,(SEARCH(" ",B2,1)+1)))−(SEARCH(" ",B2,1)+1))))

And here is a better way to get ‘lastname’ if you have a list of names that may have an initial or a middle name.
RIGHT(B2,(SEARCH(" ",B2)))

56 Responses to “How to separate first names and last names in Apple Numbers App”

  1. Stephanie says:

    This helped tremendously. Thank you!

  2. Thank you. This formula for separating first and last names on an Apple Spreadsheet Page worked fast and easy. Thanks for sharing.

  3. Bastion says:

    You know that the “better way” to extract the last name doesn’t work at all, right?

    RIGHT(B2,(SEARCH(” “,B2)))

    This search finds the position of the FIRST space when counting from the LEFT. You need to take the length of the whole string and subtract the found position, then you can use that number to extract from the right.

    This ONLY works, though, when the name has just two parts (because, again, the search starts from the LEFT and finds the first word break) – middle names, titles, multiple non-hyphenated surnames, or ordinals at the end will still mess it up.

    • Wayne says:

      I see what you mean!

    • Bastion says:

      PS: I found the solution that works: :-D

      SUBSTITUTE(FullName,” “,”#”,
      LEN(FullName)−LEN(SUBSTITUTE(FullName,” “,””)))))

      What it does is first subtract from the length of the original FullName the length of the substituted FullName where all spaces were removed. This tells you how many word breaks there are (or at least number of spaces, in case you have some double-spaced breaks – but it works for this purpose regardless).

      With that count you throw that right back into a substitute on the FullName to change the last space into a “#” (use whatever tagging character works for your data). Now you have a marker for the last word.

      Using search you can find the position of the “#”, which when again subtracted from the original FullName’s length gives you the size of the last word, so that you can finally bite that many characters into the FullName from the right.


  4. Jojo says:

    It worked! Thank you

  5. Emily Steele says:

    WOW I have to say THANK YOU this was so so helpful.

  6. Katie says:

    Thank you so much!!!

  7. Paul Smith says:

    Thanks, but when I try to delete the original full name column it puts those triangles with the exclamation mark in new columns. I guess the new columns are pulling from the original? How do I get rid of original without messing up the new? Make sense?

  8. donna says:

    My spreadsheet has several rows. How do I apply the equation for the entire column?

Leave a Reply

Copyright © 2013 Wayne Connor. All rights reserved. | Hosted on bluehost.com Click here to find out why.