Lookup across multiple dynamic array columns

Tashat

Board Regular
Joined
Jan 12, 2005
Messages
137
Office Version
  1. 365
Platform
  1. Windows
Hi All

I'm looking for help to perform a lookup across three columns. These are all dynamic arrays, so could all change in length. I've managed to stack three columns together as shown in column L below. I am now looking for a formula for column L whereby the entry in Column K is looked up in either column B, column E, or column I and the count from the adjacent column (C, F, or I) is returned. I've tried merging IFERROR and SUMPRODUCT, but it only works for one of the arrays depending on the order I enter the formula, so this doesn't work. The whole sheet is getting quite ugly unfortunately. The counts in columns C, F and J are generated using CountIf from elsewhere in the Workbook, but this fruit and veg example is just a small version I've generated for the purposes of asking on here. Any help would be much appreciated.

Fruit Example.xlsm
ABCDEFGHIJKL
1Fruits AlphabeticalFruit ConcatFruit CountVegVeg ConcatVeg CountOther FoodOther Food SortOther Food ArrayOther Food CountStacked ListStacked Count Lookup
2ApplesWhole Apples5CarrotsWhole Carrots2Cheese*Individual Item*Individual Item1*Individual Item1
3BananaWhole Banana3PotatoesWhole Potatoes3BreadBreadBread4Bread4
4BlueberriesWhole Blueberries4SwedeWhole Swede1ButterButterButter2Butter2
5GrapesWhole Grapes1TurnipsWhole Turnips3KetchupCerealCereal5Cereal5
6MelonWhole Melon3*Individual ItemCheeseCheese3Cheese3
7PearsWhole Pears2CerealKetchupKetchup1Ketchup1
8PineappleWhole Pineapple1MilkMilkMilk3Milk3
9StrawberriesWhole Strawberries2Whole Carrots2
10Whole Potatoes3
11Whole Swede1
12Whole Turnips3
13Whole Apples5
14Whole Banana3
15Whole Blueberries4
16Whole Grapes1
17Whole Melon3
18Whole Pears2
19Whole Pineapple1
20Whole Strawberries2
Sheet2
Cell Formulas
RangeFormula
A2:A9A2=SORT(FruitList)
B2:B9,E2:E5B2="Whole "&A2#
D2:D5D2=SORT(Veg_LIst)
H2:H8H2=SORT(OtherFood)
I2:I8I2=H2#
K2:K20K2=LET(range1,I2#,range2,Veg_List_Sort,range3,B2#,rows1,ROWS(range1),rows2,ROWS(range2),rows3,ROWS(range3),cols1,COLUMNS(range1),rowindex,SEQUENCE(rows1+rows2+rows3),colindex,SEQUENCE(1,cols1),IF(rowindex<=rows1,INDEX(range1,rowindex,colindex),IF(rowindex<=(rows1+rows2),INDEX(range2,rowindex-rows1,colindex),INDEX(range3,rowindex-(rows1+rows2),colindex))))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
FruitList=Sheet3!$A$2:INDEX(Sheet3!$A:$A,COUNTA(Sheet3!$A:$A))A2:B2
OtherFood=Sheet2!$G$2:INDEX(Sheet2!$G:$G,COUNTA(Sheet2!$G:$G))H2
OtherFoodArray=Sheet2!$I$2:INDEX(Sheet2!$I:$I,COUNTA(Sheet2!$I:$I))K2
Veg_LIst=Sheet3!$B$2:INDEX(Sheet3!$B:$B,COUNTA(Sheet3!$B:$B))D2
Veg_List_Sort=Sheet2!$E$2:INDEX(Sheet2!$E:$E,COUNTA(Sheet2!$E:$E))K2
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I can't test it because I don't have the source data for the names ranges, see if this works.
Excel Formula:
=SUMIFS(C:J,B:I,K2#)
 
Upvote 0
Solution
I can't test it because I don't have the source data for the names ranges, see if this works.
Excel Formula:
=SUMIFS(C:J,B:I,K2#)
Wow! That is brilliant. I was definitely overcomplicating it! Thank you so much.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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