Ok, so what I've described above is a dumbed down version of what I'm doing, as the Data set is quiet large ($A$6:$DU$1630). This Data set is a Power Query from a csv file that is now in a table on a separate sheet. That being said ill use the smaller values so it doesn't get too crazy.
So as stated there is a table/array/range of Data that corresponds to each Code.
As an example ill list a couple of names based on the above example.
LAX = ($A$1:$Z$4) its named range is LAX_Rng
A B C etc to Z
1 BP-1 2000 200
2 TP-2 2000 200
3 St-3 2600 80
4 St-4 2600 80
SF = ($A$6:$W$10) its named range is SF_Rng
A B C etc to Z
6 BP-1 3000 200
7 TP-2 3000 200
8 St-3 2600 80
9 St-4 2600 80
10 St-5 2600 80
Ive tried a few formulas but the end result needs to keep the same format, place the first range and repeat N times below itself until all ranges have been added in.
so the result would look like this:-
A B C etc to Z
1 LAX(1)-BP-1 2000 200
2 LAX(1)-TP-2 2000 200
3 LAX(1)-St-3 2600 80
4 LAX(1)-St-4 2600 80
5 LAX(2)-BP-1 2000 200
6 LAX(2)-TP-2 2000 200
7 LAX(2)-St-3 2600 80
8 LAX(2)-St-4 2600 80
9 LAX(3)-BP-1 2000 200
10 LAX(3)-TP-2 2000 200
11 LAX(3)-St-3 2600 80
12 LAX(3)-St-4 2600 80
13 SF(1)-BP-1 2000 200
14 SF(1)-TP-2 2000 200
15 SF(1)-St-3 2600 80
16 SF(1)-St-4 2600 80
etc
This is the real formula that I am currently using to find the correct Range based on the first result in the list.
={IF(AND(OrderForm!AI17=CNC_Tbl!$A$6,ROWS($A$5:A5)>VLOOKUP(OrderForm!AI17,CNC_Tbl!DX5:DY180,2)),IF(OrderForm!AI17=CNC_Tbl!$A$6,W2630NB_N3_CNC,""),"")}
each range has different numbers of Rows that i have a count for but ranges from 9 out to 30 Rows. After you mentioned Power Query it got me thinking that I could do a search Power Query to make the table. Once this table is complete i need to send it back out as a csv file.