Separate out first and last name

Nordicrx8

Board Regular
Joined
Dec 10, 2015
Messages
143
Office Version
  1. 365
Platform
  1. Windows
Hey all!

I have a very long list of employees in which I need to extract their names into a consistent format.

I'm using the below formulas with a 99% success rate, however employees with a suffix of "JR" or "II" (etc) are throwing a monkey wrench in the calculation.

First:
=MID(P14082,FIND(" ",P14082,1)+1,256)

Last:
=LEFT(P14082,(FIND(" ",P14082,1)-1))


Here is the format of my data:

Firstname Suffix LastName MiddleInitial


I ONLY need the first and last name. Is there a formula out there that can overcome the 2% of my names that have a suffix?

Thanks for the help team!

Best,
Chris
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Column1Column1Text After Delimiter
Firstname Suffix LastName MiddleInitialFirstnameLastName

if this is representative source data use PowerQuery (Get&Transform)

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TAD = Table.AddColumn(Source, "Text After Delimiter", each Text.AfterDelimiter([Column1], " "), type text),
    TBD = Table.TransformColumns(TAD, {{"Column1", each Text.BeforeDelimiter(_, " "), type text}}),
    TBTD = Table.TransformColumns(TBD, {{"Text After Delimiter", each Text.BetweenDelimiters(_, " ", " "), type text}})
in
    TBTD[/SIZE]
 
Upvote 0
I've never worked with power queries before - I've tried doing some research on them, but what I've found seems to be for older versions of excel. (I have the newest version of Excel; Office 365 ProPlus 64bit) I tried opening up power pivot (which is the same as power query, I assume) and I'm not able to replicate the steps below.

COuld you provide me with additional guidance, or point me to a newbie friendly resource on this? Or is there another way to get the data I'm looking for?

Thank you!!
 
Upvote 0
so you've PowerQuery built-in (Get&Transform)
and NO, PowerPivot is NOT the same as PowerQuery
 
Upvote 0
Last edited:
Upvote 0
Since you have the newest version of Excel, have you tried Flash Fill?
 
Upvote 0
I believe you got your formulas mixed up. Anyways, try these and let me know if they work:

First name: =LEFT(A1,FIND(" ",A1)-1)
Last name: =LEFT(MID(MID(A1,FIND(" ",A1)+1,256),FIND(" ",MID(A1,FIND(" ",A1)+1,256))+1,256),FIND(" ",MID(MID(A1,FIND(" ",A1)+1,256),FIND(" ",MID(A1,FIND(" ",A1)+1,256))+1,256))-1)
 
Upvote 0
I did the following with some helper columns:



Book1
ABCDE
1John Kennedy FitzgeraldKennedy FitzgeraldKennedy FitzgeraldJohnKennedy
2Gerald Jr. Ford RudolphJr. Ford RudolphFord RudolphGeraldFord
3James Jr. Carter EarlJr. Carter EarlCarter EarlJamesCarter
4George Bush HerbertBush HerbertBush HerbertGeorgeBush
5John Jr. Cooledge CalvinJr. Cooledge CalvinCooledge CalvinJohnCooledge
6William III Smith F.III Smith F.Smith F.WilliamSmith
Sheet1
Cell Formulas
RangeFormula
B1=RIGHT(A1,LEN(A1)-FIND(" ",A1))
C1=IF(OR(LEFT(B1,4)="Jr. ",LEFT(B1,4)="Sr .",LEFT(B1,4)="II ",LEFT(B1,4)="III ",LEFT(B1,4)="Esq."),RIGHT(B1,LEN(B1)-4),B1)
D1=LEFT(A1,FIND(" ",A1)-1)
E1=LEFT(C1,FIND(" ",C1)-1)
 
Upvote 0
I didn't account for the suffix and middle name initial in my last name formula, revised version below.

=LEFT(MID(MID(A1,FIND(" ",A1)+1,256),IFERROR(FIND(" ",MID(A1,FIND(" ",A1)+1,256)),0)+1,256),IFERROR(FIND(" ",MID(MID(A1,FIND(" ",A1)+1,256),FIND(" ",MID(A1,FIND(" ",A1)+1,256))+1,256)),255)-1)
 
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,136
Members
448,551
Latest member
Sienna de Souza

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top