Split one column with different delimiters into three new ones by rows

montyfern

Board Regular
Joined
Oct 12, 2017
Messages
65
Hi Everyone,

I've read some posts and think this will be very easy for you pros. The closest post uses the same delimiter which this data doesn't provide. Thus, I need to split this column into rows, unpivot, then split by position into a table format? I would please like: Max Goodwin to be first entry under column 1 called NAME (reverse first/last name), then column 2 called DIVISION with FAA/ABC [E] first entry under it, and column 3 is MEMBER with Member under it. They're all members. Much Obliged!

Column1
Goodwin, Max (FAA/ABC) [E]
FDA/DCC/HDRP/HAS
Member
Bond, James (FDC/FIA/ERP) [E]
FAA/DCC/HDRP/HAS
Member
Pearson, Beth (NIH/NCI) [E]
FDA/DCC/HDRP/HAS
Member
Simpson, Homer (NIH/NCI) [E]
Program Director
FAA/DCC/HDRP/HAS
Member
Griffin, Peter (NIH/NCI) [E]
Program Director
FDA/DCC/HDRP/HAS
Member
Hoyt, Jenny (NIH/NCI) [E]
ABC/DCC/HDRP/HAS
Member
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    Filter = Table.SelectRows(Source, each Text.Contains([Column1], ",")),
    Split = Table.SplitColumn(Filter, "Column1", Splitter.SplitTextByDelimiter(" (", QuoteStyle.Csv), {"nm", "DIVISION"}),
    Replace = Table.ReplaceValue(Split,")","",Replacer.ReplaceText,{"DIVISION"}),
    Split1 = Table.SplitColumn(Replace, "nm", Splitter.SplitTextByDelimiter(", ", QuoteStyle.Csv), {"ln", "fn"}),
    Merge = Table.CombineColumns(Split1,{"fn", "ln"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"NAME"),
    AddCol = Table.AddColumn(Merge, "MEMBER", each "Member")
in
    AddCol

Book1
ABCDEF
1Column1NAMEDIVISIONMEMBER
2Goodwin, Max (FAA/ABC) [E]Max GoodwinFAA/ABC [E]Member
3FDA/DCC/HDRP/HASJames BondFDC/FIA/ERP [E]Member
4MemberBeth PearsonNIH/NCI [E]Member
5Bond, James (FDC/FIA/ERP) [E]Homer SimpsonNIH/NCI [E]Member
6FAA/DCC/HDRP/HASPeter GriffinNIH/NCI [E]Member
7MemberJenny HoytNIH/NCI [E]Member
8Pearson, Beth (NIH/NCI) [E]
9FDA/DCC/HDRP/HAS
10Member
11Simpson, Homer (NIH/NCI) [E]
12Program Director
13FAA/DCC/HDRP/HAS
14Member
15Griffin, Peter (NIH/NCI) [E]
16Program Director
17FDA/DCC/HDRP/HAS
18Member
19Hoyt, Jenny (NIH/NCI) [E]
20ABC/DCC/HDRP/HAS
21Member
22
Sheet2
 
Upvote 0
Solution
Absolutely brilliant JGordon11 or Austin Powers! :) I need to learn M code! Did you write the code from scratch? MANY thanks.
 
Upvote 0
YW. This one can be completely done via the user interface. I used rename steps to get rid of the #"StepName" distractions and advanced editor to shorten some column names, but could be completely done via UI. However, many tasks cannot be done with just the UI so learning to use M code expands PQ capabilities manyfold over using the UI alone.
 
Upvote 0

Forum statistics

Threads
1,223,670
Messages
6,173,716
Members
452,528
Latest member
ThomasE

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