Text to columns 3 columns need only 2

Status
Not open for further replies.

bobkap

Active Member
Joined
Nov 22, 2009
Messages
313
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
I have a list of names where both first and last name is separated by a comma. I need to have the last name in one column and the first in another. I think I've figured out how to do that with this code below. Except I cannot figure out how to address this:
1. If the person's first name is two words (ex.: Billy Joe; or Bobby Sue etc) I end up with 3 columns, not 2. I thought the "consecutive delimeter" would address that but it does not. Might anyone know how to handle that please so I end up with just 2 columns?
 

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.
With Power Query/Get and Transform Data found on the Data Tab

Book1
ABCD
1NameName.1Name.2
2Billy Bob ThorntonBilly BobThornton
3Bobby Sue SmithBobby SueSmith
4James JonesJamesJones
5Amit PatelAmitPatel
6
Sheet1


Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Name", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Name.1", "Name.2"})
in
    #"Split Column by Delimiter"
 
Upvote 0
Duplicate to: Text to columns to 3 columns

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

If there are follow-up questions then please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,823
Messages
6,121,779
Members
449,049
Latest member
greyangel23

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