SOLVED

add raw data in one cell

%3CLINGO-SUB%20id%3D%22lingo-sub-1547139%22%20slang%3D%22en-US%22%3Eadd%20raw%20data%20in%20one%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1547139%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Team%2C%3C%2FP%3E%3CP%3Ei%20need%20your%20help%20that%20i%20have%20data%20in%20my%20sheet%20i%20want%20to%20add%20in%20one%20cell%20with%20the%20help%20of%20power%20query%20excel%20does%20any%20one%20help%20me%20out%20files%20is%20attached.%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EYasir%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1547139%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1547878%22%20slang%3D%22en-US%22%3ERe%3A%20add%20raw%20data%20in%20one%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1547878%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F725503%22%20target%3D%22_blank%22%3E%40MuhammadYasir%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20what%20you%20have%20is%20laid%20out%20just%20like%20this%20little%20sample%2C%20you%20don't%20really%20need%20Power%20Query.%20A%20simple%20TEXTJOIN%20function%20could%20do%20it%20put%20those%20two%20cells%20together.%20For%20example%2C%20put%20this%20in%20Cell%20B3%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DTEXTJOIN(%22%20%22%2C1%2CTable2%5B%40%5BOriginal%20Data%5D%5D%2CA4)%26nbsp%3B%26nbsp%3B%3C%2FSTRONG%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20that%20would%20still%20leave%20you%20with%20a%20blank%20row%2C%20which%20you%20probably%20don't%20want.%20So%20why%20don't%20you%20give%20us%20the%20bigger%20picture%2C%20the%20context%20and%20the%20purpose%20you're%20wanting%20to%20achieve%20beyond%20just%20putting%20those%20two%20bits%20of%20text%20together.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1548784%22%20slang%3D%22en-US%22%3ERe%3A%20add%20raw%20data%20in%20one%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1548784%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECouple%20of%20more%20variants%20if%20put%20data%20in%20separate%20table%20without%20empty%20rows%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22image.png%22%20style%3D%22width%3A%20789px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F208289i4DBA0E36280A646A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22image.png%22%20alt%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E1)%20Create%20new%20table%20and%20use%20formula%20for%20it%20like%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DIFERROR(INDEX(Table2%5BOriginal%20Data%5D%2C%20(ROW()-ROW(Table3%5B%5B%23Headers%5D%2C%5BOutput%5D%5D))*2-1)%20%26amp%3B%20%22%20%22%20%26amp%3B%0A%20INDEX(Table2%5BOriginal%20Data%5D%2C%20(ROW()-ROW(Table3%5B%5B%23Headers%5D%2C%5BOutput%5D%5D))*2)%2C%22%22)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2)%20With%20Power%20Query%20add%20Index%20column%20starting%20from%200%2C%20integer%20divide%20it%20on%202%2C%20group%20on%20that%20column%20and%20slightly%20modify%20formula%20for%20grouping%20in%20formula%20bar%20as%20in%20script%20below%2C%20remove%20index%20column%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powerquery%22%3E%3CCODE%3Elet%0A%20%20%20%20Source%20%3D%20Excel.CurrentWorkbook()%7B%5BName%3D%22Table2%22%5D%7D%5BContent%5D%2C%0A%20%20%20%20%23%22Added%20Index%22%20%3D%20Table.AddIndexColumn(Source%2C%20%22Index%22%2C%200%2C%201%2C%20Int64.Type)%2C%0A%20%20%20%20%23%22Integer-Divided%20Column%22%20%3D%20Table.TransformColumns(%23%22Added%20Index%22%2C%20%7B%7B%22Index%22%2C%20each%20Number.IntegerDivide(_%2C%202)%2C%20Int64.Type%7D%7D)%2C%0A%20%20%20%20%23%22Grouped%20Rows%22%20%3D%20Table.Group(%23%22Integer-Divided%20Column%22%2C%20%7B%22Index%22%7D%2C%20%7B%7B%22Output%22%2C%20each%20Text.Combine(%20_%5BOriginal%20Data%5D%2C%20%22%20%22)%7D%7D)%2C%0A%20%20%20%20%23%22Removed%20Columns%22%20%3D%20Table.RemoveColumns(%23%22Grouped%20Rows%22%2C%7B%22Index%22%7D)%0Ain%0A%20%20%20%20%23%22Removed%20Columns%22%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1549629%22%20slang%3D%22en-US%22%3ERe%3A%20add%20raw%20data%20in%20one%20cell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1549629%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi Team,

i need your help that i have data in my sheet i want to add in one cell with the help of power query excel does any one help me out files is attached.

Thanks

Yasir 

 

 

3 Replies

@MuhammadYasir 

 

If what you have is laid out just like this little sample, you don't really need Power Query. A simple TEXTJOIN function could do it put those two cells together. For example, put this in Cell B3

=TEXTJOIN(" ",1,Table2[@[Original Data]],A4)   

 

But that would still leave you with a blank row, which you probably don't want. So why don't you give us the bigger picture, the context and the purpose you're wanting to achieve beyond just putting those two bits of text together.

Best Response confirmed by MuhammadYasir (New Contributor)
Solution

@mathetes 

Couple of more variants if put data in separate table without empty rows:

image.png

1) Create new table and use formula for it like

=IFERROR(INDEX(Table2[Original Data], (ROW()-ROW(Table3[[#Headers],[Output]]))*2-1) & " " &
 INDEX(Table2[Original Data], (ROW()-ROW(Table3[[#Headers],[Output]]))*2),"")

 

2) With Power Query add Index column starting from 0, integer divide it on 2, group on that column and slightly modify formula for grouping in formula bar as in script below, remove index column

let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
    #"Integer-Divided Column" = Table.TransformColumns(#"Added Index", {{"Index", each Number.IntegerDivide(_, 2), Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Integer-Divided Column", {"Index"}, {{"Output", each Text.Combine( _[Original Data], " ")}}),
    #"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Index"})
in
    #"Removed Columns"

Thanks @mathetes