Forum

Notifications
Clear all

Merge 2 Lists

4 Posts
3 Users
0 Reactions
235 Views
(@joerg)
Posts: 4
Active Member
Topic starter
 

Hello

I have a query with Id numbers and 2 columns with lists.

Example:

Id List A List B
39
      40


          The data behind look like this, List A and List B can also have empty entries. 

          Id List A List B
          39 a 1734
          39 b 647
          39 c 1913
          39   1527
          40 a 1370
          40 b  
          40 c 1741
          40 d 1386

          I want to merge both lists by positions, but without expanding them first, the desired result should be

          Id List A List B result
          39
                40

                      I have no idea how to do that.

                      Thanks for your ideas.

                      Joerg

                       
                      Posted : 09/04/2021 8:57 am
                      (@mynda)
                      Posts: 4761
                      Member Admin
                       

                      Hi Joerg,

                      Welcome to our forum! Please provide a sample Excel file so we can help you further.

                      Mynda

                       
                      Posted : 09/04/2021 7:04 pm
                      (@catalinb)
                      Posts: 1937
                      Member Admin
                       

                      Try adding a new column with the formula:
                      List.Zip({[ListA],[ListB]})

                      Those 2 lists must have the same number of elements.

                       
                      Posted : 09/04/2021 10:29 pm
                      (@joerg)
                      Posts: 4
                      Active Member
                      Topic starter
                       

                      Hello Mynda and Catalin

                      Unfortunately I can't upload a file, since the source is a sharepoint which you can't access.

                      List.Zip comes with error, because both lists have different nos. of elements.

                      This did now what I expected:

                      Table.ToRows(Table.FromColumns({[ListA],[ListB]}))

                       

                      Thanks for your help.

                      Joerg

                       
                      Posted : 10/04/2021 3:31 am
                      Share: