Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Function(?) to Extract from Excel cells

  • 14-09-2006 06:07PM
    #1
    Closed Accounts Posts: 373 ✭✭


    I have a list in Excel that looks like:

    Brian B. Byrne
    John Doyle
    Bob X. Hope
    Jimmy O'Reilly
    Betty Boo
    Johnny O' Murtagh


    I need to get it into two columns looking like:
    Brian
    John
    Bob
    Jimmy
    Betty
    Johnny

    and

    Byrne
    Doyle
    Hope
    O'Reilly
    Boo
    O' Murtagh


    I.e. first names and last names.

    First name extraction is easy - search for position of first space and then use function to remove to that number of characters.

    What can I use for Surnames though?
    A function that searches from Right for first space and then extracts from Right to that num characters would do it (i.e. exact oposite of what I used for first name) but that doesnt seem to exist.
    Obviously that would not take care of cases such as:
    Johnny O' Murtagh ; where the formatting is a little different but I could live with that... unless someone has an idea that will take care of that too?


Comments

  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭SwampThing


    quick and nasty...

    first name
    =LEFT(A1,FIND(" ",A1))

    surname
    =MID(A1, FIND(" ",A1,1),99)


  • Closed Accounts Posts: 373 ✭✭Faltermyer


    That wont do surname because it will give me middle initials also??


  • Registered Users, Registered Users 2 Posts: 944 ✭✭✭SwampThing


    OK, OK - keep your shirt on :)

    surname...

    first, this into column B
    =TRIM(MID(A2, FIND(" ",A2,1),99))

    and then this into column C
    =IF(ISNUMBER(FIND(".",B2)),TRIM(MID(B2,FIND(".",B2)+1,99)),TRIM(B2))


Advertisement