Lookup column reference, return list of non-blank values in table?

SarahLouM

New Member
Joined
Nov 9, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello - I'm struggling with this one and my basic excel knowledge.
I have a list of recipes and ingredients - I'd like to put these into table format, and then have a formula to lookup a certain recipe number and return the ingredients and quantities used in that recipe.
I've put recipe numbers as headers and ingredients down the first column purely because it allows me to add recipes to the main table more easily - can change this if required.
For example:
1.01.11.2
Apples1000100
Pears100
Sugar500200100
Chocolate10050

Ideally, I'd like to create a sheet where I can enter "1.0" and return a list of ingredients used in recipe 1.0 and their quantities. Then if this cell is changed to recipe 1.1, it updates to that recipe info, etc.
I want it to ignore any ingredients that have blank values.

Does anyone have any tips for this? I've cobbled together formulas that can look up specific ingredients and return their value, but not managed to figure out something that will return a whole list based off looking up another column.
Does my table layout need to be flipped or changed to allow this?
I'm using excel 365.

Thanks!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome to the MrExcel board!

Try this

21 11 10.xlsm
ABCDEFGH
11.01.11.2RecipeIngredients
2Apples10001001.2Apples
3Pears100Sugar
4Sugar500200100Chocolate
5Chocolate10050
6
Recipes
Cell Formulas
RangeFormula
H2:H4H2=FILTER(A2:A5,FILTER(B2:D5,B1:D1=G2)<>"")
Dynamic array formulas.
 
Upvote 0
Hmm, you probably want the quantities too?

21 11 10.xlsm
ABCDEFGHI
1Ingredients1.01.11.2Recipe
2Apples1000100Ingredients1.2Apples100
3Pears100Sugar100
4Sugar500200100Chocolate50
5Chocolate10050
6
Recipes (2)
Cell Formulas
RangeFormula
H2:I4H2=LET(f,FILTER(A2:D5,COUNTIF(F2:G2,A1:D1)),FILTER(f,INDEX(f,0,2)>0))
Dynamic array formulas.
 
Upvote 0
Solution
Hmm, you probably want the quantities too?

21 11 10.xlsm
ABCDEFGHI
1Ingredients1.01.11.2Recipe
2Apples1000100Ingredients1.2Apples100
3Pears100Sugar100
4Sugar500200100Chocolate50
5Chocolate10050
6
Recipes (2)
Cell Formulas
RangeFormula
H2:I4H2=LET(f,FILTER(A2:D5,COUNTIF(F2:G2,A1:D1)),FILTER(f,INDEX(f,0,2)>0))
Dynamic array formulas.
Fantastic - This should work!
Does this formula rely on the 'ingredients' text in F2? What part of the formula would I amend if I wanted to move this to another cell?

Thanks for your help
 
Upvote 0
Does this formula rely on the 'ingredients' text in F2?
It does rely on that text but it does not have to be in F2. Ideally it does need to be near the recipe number though. Here are a couple of other workable arrangements.

21 11 10.xlsm
ABCDEFGHIJKLM
1Ingredients1.01.11.2Recipe1.2Ingredients1.2
2Apples1000100Apples100IngredientsApples100
3Pears100Sugar100Sugar100
4Sugar500200100Chocolate50Chocolate50
5Chocolate10050
Recipes (3)
Cell Formulas
RangeFormula
H2:I4H2=LET(f,FILTER(A2:D5,COUNTIF(H1:I1,A1:D1)),FILTER(f,INDEX(f,0,2)>0))
L2:M4L2=LET(f,FILTER(A2:D5,COUNTIF(K1:K2,A1:D1)),FILTER(f,INDEX(f,0,2)>0))
Dynamic array formulas.


If it is a visual thing that you don't like it, you could say leave it in F2 like I had it earlier and just hide column F.

21 11 10.xlsm
ABCDEGHI
1Ingredients1.01.11.2Recipe
2Apples10001001.2Apples100
3Pears100Sugar100
4Sugar500200100Chocolate50
5Chocolate10050
Recipes (2)
Cell Formulas
RangeFormula
H2:I4H2=LET(f,FILTER(A2:D5,COUNTIF(F2:G2,A1:D1)),FILTER(f,INDEX(f,0,2)>0))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,734
Messages
6,126,542
Members
449,316
Latest member
sravya

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