There's no way that array formula you were building was going to survive expansion to 6 sheets and remain usable. Here's a simpler approach made possible by the addition of a KEY column added to each of the Product Sheets. The KEY column simply flags a row when it is appropriate to include in the ORDER sheet by watching the QTY column.
Now, the KEY column for each Product sheet flows from the KEY column of the previous Product sheet.
Then, to make it visually understandable, I added an "ITEM" column A to the Order Sheet. The formula in B2 now compares the ITEM number to MAXimum "key" value. If it's higher, the row will suppress. If it's NOT higher, then a simple INDEX/MATCH is used on the first Product sheet looking for Item #1.
If it's NOT found and an error occurs, the IFERROR function I installed causes the "search" to continue on the next Product sheet...and so on through all 6 product sheets.
Here's the IFERROR code:
1. Open up your workbook.
2. Get into VB Editor (Press Alt+F11)
3. Insert a new module (Insert > Module)
4. Copy and Paste in your code (given above)
5. Get out of VBA (Press Alt+Q)
6. Save your sheet.
The one formula in B2 is designed so it can be copied down and over as far as needed and it will work. Here's the HUGE formula that results, but it's all INDEX/MATCH stuff so should remain robust:
=IF($A2>MAX(Product7!$F:$F),"",iferror(INDEX(Product1!A:A,MATCH($A2,Product1!$F:$F,0)),
iferror(INDEX(Product2!A:A,MATCH($A2,Product2!$F:$F,0)),
iferror(INDEX(Product3!A:A,MATCH($A2,Product3!$F:$F,0)),
iferror(INDEX(Product4!A:A,MATCH($A2,Product4!$F:$F,0)),
iferror(INDEX(Product5!A:A,MATCH($A2,Product5!$F:$F,0)),
INDEX(Product6!A:A,MATCH($A2,Product6!$F:$F,0))))))))
This technique should scale up smoothly.
Bookmarks