Home

parsing the text

%3CLINGO-SUB%20id%3D%22lingo-sub-182817%22%20slang%3D%22en-US%22%3Eparsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-182817%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20interested%20in%20how%20to%20convert%20text%20that%20is%20grouped%20in%20one%20cell%20(with%20line%20break%20%22alt%2Breturn%22)%20into%20each%20cell%20individually.%20And%20vice%20versa.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20see%20attached%20picture.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-182817%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-344868%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-344868%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F284663%22%20target%3D%22_blank%22%3E%40fazly858%3C%2FA%3E%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESorry%2C%20but%20I%20can't%20figure%20out%20a%20suitable%20solution%20to%20convert%20that%20raw%20data%20to%20what%20you%20want.%3C%2FP%3E%3CP%3EI%20suggest%20you%20re-post%20this%20request%20as%20a%20new%20post%20in%20the%20community.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-340121%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-340121%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Mr%20Amairah%2C%3C%2FP%3E%3CP%3EI%20have%20a%20problem%20to%20sort%20multiple%20text%20in%20one%20cell%20into%20multiple%20cell.%3C%2FP%3E%3CP%3EPlease%20see%20my%20attachment%20on%20my%20raw%20data%20and%20my%20wanted%20data%20to%20be.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20you%20teach%20me%20how%20to%20change%20into%20that%20wanted%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EReally%20appreciate%20your%20assistance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183167%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183167%22%20slang%3D%22en-US%22%3E%3CP%3EPERFECT!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183127%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183127%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Matej%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESorry%20about%20that!%3C%2FP%3E%3CP%3EThis%20is%20because%20of%20the%20conflict%20between%20data%20types.%3C%2FP%3E%3CP%3EThe%20records%20in%20cells%20A5%20and%20A6%20are%20actual%20numbers%20but%20the%20rest%20are%20texts%20because%20they%20contain%20some%20line%20breaks%20and%20forward%20slashes.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnyway%2C%20I've%20updated%20the%20query%20to%20take%20into%20account%20this%20issue%20and%20convert%20all%20the%20records%20to%20texts%20from%20the%20beginning.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-183074%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-183074%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Haytam%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethis%20works%20great%20but%20only%20if%20I%20have%20text%20value.%20If%20I%20have%20only%20one%20number%20in%20cell%20i%20get%20an%20error.%20Why%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20see%20attached%20picture.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-182835%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-182835%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20a%20comment%2C%20better%20to%20split%20by%20line%20break%20delimiter%3C%2FP%3E%0A%3CPRE%3Elet%0A%20%20%20%20Source%20%3D%20Excel.CurrentWorkbook()%7B%5BName%3D%22Table1%22%5D%7D%5BContent%5D%2C%0A%20%20%20%20SplitByLF%20%3D%20Table.SplitColumn(Source%2C%20%22Letters%22%2C%0A%20%20%20%20%20%20%20%20Splitter.SplitTextByDelimiter(%22%23(lf)%22%2C%20QuoteStyle.Csv)%2C%20%7B%22Letters.1%22%2C%20%22Letters.2%22%2C%20%22Letters.3%22%7D)%2C%0A%20%20%20%20Unpivot%20%3D%20Table.UnpivotOtherColumns(SplitByLF%2C%20%7B%7D%2C%20%22Attribute%22%2C%20%22Letters%22)%2C%0A%20%20%20%20Remove%20%3D%20Table.RemoveColumns(Unpivot%2C%7B%22Attribute%22%7D)%0Ain%0A%20%20%20%20Remove%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-182832%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-182832%22%20slang%3D%22en-US%22%3E%3CP%3EOK%2C%20please%20find%20the%20attached%20file%20to%20test%20the%20solution.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20update%20the%20row%20data%20and%20then%20r%3CSPAN%3Eefresh%3C%2FSPAN%3Ethe%20next%20table%20(Right%20Click%20%26gt%3B%26gt%3B%20Refresh)%20to%20see%20how%20it%20works.%3CBR%20%2F%3E%3CSPAN%3EThis%20table%20is%20linked%20to%20a%20query%20that%20works%20behind%20the%20scenes%20and%20it%20converts%20the%20data%20to%20the%20shape%20you%20want!%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ENOTE%3A%3C%2FSTRONG%3E%3CSPAN%3EIf%20you%20don't%20have%20Excel%202016%2C%20you%20have%20to%20download%20and%20install%20the%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D39379%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPower%20Query%20add-in%3C%2FA%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EUpdate%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI've%20updated%20the%20query%20in%20the%20workbook%2C%20looks%20like%20it%20was%20buggy!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-182830%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-182830%22%20slang%3D%22en-US%22%3EHi%20Haytham%2C%3CBR%20%2F%3E%3CBR%20%2F%3Eno%20problem.%20I%20have%20windows%20too.%20Can%20you%20show%20me%20how%20to%20do%20it%3F%3CBR%20%2F%3EThank%20you.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-182828%22%20slang%3D%22en-US%22%3ERe%3A%20parsing%20the%20text%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-182828%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Matej%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20can%20easily%20be%20done%20by%20using%20Get%20%26amp%3B%20Transform%20(Power%20Query).%3CBR%20%2F%3EBut%20unfortunately%2C%20it's%20not%20supported%20on%20the%20Mac!%3C%2FP%3E%3C%2FLINGO-BODY%3E
matej papez
Occasional Contributor

Hi,

 

I am interested in how to convert text that is grouped in one cell (with line break "alt+return") into each cell individually. And vice versa.

 

Please see attached picture.

9 Replies

Hi Matej,

 

This can easily be done by using Get & Transform (Power Query).
But unfortunately, it's not supported on the Mac!

Hi Haytham,

no problem. I have windows too. Can you show me how to do it?
Thank you.

OK, please find the attached file to test the solution.

 

You can update the row data and then refresh the next table (Right Click >> Refresh) to see how it works.
This table is linked to a query that works behind the scenes and it converts the data to the shape you want!

 

NOTE: If you don't have Excel 2016, you have to download and install the Power Query add-in.

 

Update:

I've updated the query in the workbook, looks like it was buggy!

As a comment, better to split by line break delimiter

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    SplitByLF = Table.SplitColumn(Source, "Letters",
        Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), {"Letters.1", "Letters.2", "Letters.3"}),
    Unpivot = Table.UnpivotOtherColumns(SplitByLF, {}, "Attribute", "Letters"),
    Remove = Table.RemoveColumns(Unpivot,{"Attribute"})
in
    Remove

 

Hi Haytam,

 

this works great but only if I have text value. If I have only one number in cell i get an error. Why?

 

Please see attached picture.

Hi Matej,

 

Sorry about that!

This is because of the conflict between data types.

The records in cells A5 and A6 are actual numbers but the rest are texts because they contain some line breaks and forward slashes.

 

Anyway, I've updated the query to take into account this issue and convert all the records to texts from the beginning.

PERFECT!!

 

Thank you!!

Hi Mr Amairah,

I have a problem to sort multiple text in one cell into multiple cell.

Please see my attachment on my raw data and my wanted data to be.

 

Could you teach me how to change into that wanted data.

 

Really appreciate your assistance.

 

Thank you.

Hi @fazly858,

 

Sorry, but I can't figure out a suitable solution to convert that raw data to what you want.

I suggest you re-post this request as a new post in the community.

 

Regards

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies