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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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