• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Split up text part of cell into different columns

jk51

Member
Hi,
I got a list of 1000 ww1 soldiers records.
How to split up the text in cell A1 below into next 4 columns - (B1) Name, (C1) Corps Regiment, (D1) No and (E1) Rank?

for example in cell A2 and A3 -
Amar, Bedi. Corps Regiment No Rank 36th Sikhs 3687 Sepoy.
Atma, Singh. Corps Regiment No Rank 15th Sikhs 395 Naik.

in cell B2 output = Amar, Bedi.
in cell C2 output = 36th Sikhs
in cell D2 output = 3687
in cell E2 output = Sepoy.

in cell B3 output = Atma, Singh.
in cell C3 output = 15th Sikhs
in cell D3 output = 395
in cell E3 output = Naik.

etc..

Thanks,
Mr Singh
 
Try text to column, or Power Query, aka Get & Transform (on the ribbon) then split column.
Looking at the data, and the lack of a clear delimiter, I suspect if the data is the result of an export, the length of the fields might be the same. There is a reason we ask to upload sample file.
 
An alternative solution is to use Power Query. Here is the Mcode and a file attached to show you the steps.

l
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByDelimiter(".", QuoteStyle.Csv), {"Column1.1", "Column1.2", "Column1.3"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Column1.1", type text}, {"Column1.2", type text}, {"Column1.3", type text}}),
    #"Split Column by Delimiter1" = Table.SplitColumn(#"Changed Type", "Column1.2", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Column1.2.1", "Column1.2.2", "Column1.2.3", "Column1.2.4", "Column1.2.5", "Column1.2.6", "Column1.2.7", "Column1.2.8", "Column1.2.9"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter1",{{"Column1.2.1", type text}, {"Column1.2.2", type text}, {"Column1.2.3", type text}, {"Column1.2.4", type text}, {"Column1.2.5", type text}, {"Column1.2.6", type text}, {"Column1.2.7", type text}, {"Column1.2.8", Int64.Type}, {"Column1.2.9", type text}}),
    #"Merged Columns" = Table.CombineColumns(#"Changed Type1",{"Column1.2.6", "Column1.2.7"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Merged"),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Columns",{"Column1.2.1", "Column1.2.2", "Column1.2.3", "Column1.2.4", "Column1.2.5", "Column1.3"})
in
    #"Removed Columns"
 

Attachments

  • Book1.xlsx
    18.8 KB · Views: 2
Back
Top