Inserting items to a list

PQCurious

New Member
Joined
Nov 13, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi
I have this Excel problem which I'm struggling to solve.

Input lists = {1,2,3,4,5,6,7,9}, {3,4,5,x,a,8,z}, {c,b,5,6,8}
Output list = {1,2,3,4,c,b,5,6,7,x,a,8,z,9}

Input lists are a arranged by decreasing number of items and the first list has to be used as the starting list in which items from other lists will be inserted. Items preceding a matching value in second list, will be inserted above that item in the first list, and so on.
In my actual project all items in all input lists are numbers, not in any particular order and within each input list there are no duplicates.

How to do this in either Power Query or using Excel's dynamic array functions, whichever is scalable and efficient. I have over 200 cases each with 2 to 5 input lists.

Thanks in advance.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,762
Messages
6,174,351
Members
452,557
Latest member
savvaskef

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