IAimtoMisbehave
New Member
- Joined
- Aug 31, 2014
- Messages
- 1
Hello,
I am creating a nutritional data spreadsheet to track a diet I am on.
I'm wondering if there is a way to use the Lookup function to search through named ranges that are created depending on user selections in the first sheet.
To elaborate: I have on sheet 1 my meal for breakfast where I select the food I ate in the morning using dependent lists and the spreadsheet will automatically fill out and sum up the nutritional data for that meal. On sheet 2 I have all the basic food groups (Proteins, Dairy, Vegetables, Fruits, Grains) and a number of foods that I regularly eat input in the proper food groups with their nutritional data filled in.
I'm not sure if I should just post my spreadhseet, so I'll paste some examples instead... I would be happy to attach the actual spreadsheet to make things clearer to understand, I just don't know if that is allowed or not. If its okay and someone wants me to attach it then I will!
So an example of Breakfast in sheet 1 would be:
-------------------------------------------------------------------------------------------------------------------------
[TABLE="width: 839"]
<tbody>[TR]
[TD="colspan: 7"]9/1/2014[/TD]
[/TR]
[TR]
[TD="colspan: 7"]Monday[/TD]
[/TR]
[TR]
[TD="colspan: 7"]Breakfast[/TD]
[/TR]
[TR]
[TD]Food Group[/TD]
[TD][/TD]
[TD]Proteins[/TD]
[TD]Dairy[/TD]
[TD]Fruits[/TD]
[TD]Proteins[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Food Item[/TD]
[TD]Meal Totals[/TD]
[TD]1. Egg[/TD]
[TD]1. Mozarella Cheese
[/TD]
[TD]1. Sliced Pineapple
[/TD]
[TD]3. Bacon
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]# Servings[/TD]
[TD][/TD]
[TD]2[/TD]
[TD]0.75[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Calories[/TD]
[TD]413.5[/TD]
[TD]156[/TD]
[TD]67.5[/TD]
[TD]70[/TD]
[TD]120[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fat[/TD]
[TD]21.5[/TD]
[TD]10[/TD]
[TD]4.5[/TD]
[TD]0[/TD]
[TD]7[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cholesterol[/TD]
[TD]415.25[/TD]
[TD]374[/TD]
[TD]11.25[/TD]
[TD]0[/TD]
[TD]30[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sodium[/TD]
[TD]666.5[/TD]
[TD]124[/TD]
[TD]112.5[/TD]
[TD]10[/TD]
[TD]420[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Potassium[/TD]
[TD]126[/TD]
[TD]126[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Carbohydrates[/TD]
[TD]16.75[/TD]
[TD]0[/TD]
[TD]0.75[/TD]
[TD]16[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Protein[/TD]
[TD]29.55[/TD]
[TD]12[/TD]
[TD]5.25[/TD]
[TD]0.3[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
------------------------------------------------------------------------------------------------------------------------------------------
The food group row selections are populated by selecting from a dropdown list, and the Food item dropdown list is then populated based on the foodgroup selection (So if Proteins is selected as the food group you will only get protein options to fill in the Food Items cell). Then the values for calories, fat, etc, are automatically looked up and selected from the proper lists on sheet 2.
Here is an example of Sheet 2:
-----------------------------------------------------------------------------------------------------------------------------------------
[TABLE="width: 394"]
<tbody>[TR]
[TD]Proteins[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Food Item[/TD]
[TD] 1. Egg[/TD]
[TD] 2. Tuna[/TD]
[TD] 3. Bacon[/TD]
[/TR]
[TR]
[TD]Calories[/TD]
[TD="align: right"]78[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]Fat[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]3.5[/TD]
[/TR]
[TR]
[TD]Cholesterol[/TD]
[TD="align: right"]187[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD]Sodium[/TD]
[TD="align: right"]62[/TD]
[TD="align: right"]180[/TD]
[TD="align: right"]210[/TD]
[/TR]
[TR]
[TD]Potassium[/TD]
[TD="align: right"]63[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Carbohydrates[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Protein[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]6[/TD]
[/TR]
</tbody>[/TABLE]
------------------------------------------------------------------------------------------------------------------------------------------
The items in the "Food Item" row are in a named range called "Proteins", and the items in the Calories row are in a named range called "ProteinsCalories", the Fat row items in a named range called "ProteinsFat", etc...
So in sheet 1 when I select "Proteins" and "1. Eggs" for the first food item, I need to do a lookup to go grab the value for the calories for eggs listed on sheet 2.
I am wondering if there is a way to do that for all the different food groups using a dynamic lookup instead of using a bunch of nested IF statements for all the different food groups, which is what I currently have...
Is there any way to put in something like this:
=LOOKUP(C70,C69,C69&A72)
(Note that C70 is the "1. Eggs" Selection from a dropdown, C69 is the "Proteins" selection from a dropdown, and A72 is the cell labeled "Calories")
To make it easier to read for you, that essentially translates into: =LOOKUP(1. Eggs, Proteins, ProteinsCalories)
The only problem is that I don't know how to get excel to recognize that the lookup vector and results vector in the formula should be seen as named ranges on sheet 2 as opposed to simple cell references like I have selected.
Right now I have this formula (which works but is very convoluted)(Note that C71 is the "# servings" cell):
=C71*IF(C69="Proteins",LOOKUP(C70,Proteins,ProteinsCalories),IF(C69="Dairy",LOOKUP(C70,Dairy,DairyCalories),IF(C69="Vegetables",LOOKUP(C70,Vegetables,VegetablesCalories),IF(C69="Fruits",LOOKUP(C70,Fruits,FruitsCalories),LOOKUP(C70,Grains,GrainsCalories)))))
Essentially what this boils down to is does anyone know how to conglomerate two cells into a string that can then be recognized as a named range to be used in a lookup function?
Thanks in advance for any help you can provide!
I am creating a nutritional data spreadsheet to track a diet I am on.
I'm wondering if there is a way to use the Lookup function to search through named ranges that are created depending on user selections in the first sheet.
To elaborate: I have on sheet 1 my meal for breakfast where I select the food I ate in the morning using dependent lists and the spreadsheet will automatically fill out and sum up the nutritional data for that meal. On sheet 2 I have all the basic food groups (Proteins, Dairy, Vegetables, Fruits, Grains) and a number of foods that I regularly eat input in the proper food groups with their nutritional data filled in.
I'm not sure if I should just post my spreadhseet, so I'll paste some examples instead... I would be happy to attach the actual spreadsheet to make things clearer to understand, I just don't know if that is allowed or not. If its okay and someone wants me to attach it then I will!
So an example of Breakfast in sheet 1 would be:
-------------------------------------------------------------------------------------------------------------------------
[TABLE="width: 839"]
<tbody>[TR]
[TD="colspan: 7"]9/1/2014[/TD]
[/TR]
[TR]
[TD="colspan: 7"]Monday[/TD]
[/TR]
[TR]
[TD="colspan: 7"]Breakfast[/TD]
[/TR]
[TR]
[TD]Food Group[/TD]
[TD][/TD]
[TD]Proteins[/TD]
[TD]Dairy[/TD]
[TD]Fruits[/TD]
[TD]Proteins[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Food Item[/TD]
[TD]Meal Totals[/TD]
[TD]1. Egg[/TD]
[TD]1. Mozarella Cheese
[/TD]
[TD]1. Sliced Pineapple
[/TD]
[TD]3. Bacon
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]# Servings[/TD]
[TD][/TD]
[TD]2[/TD]
[TD]0.75[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Calories[/TD]
[TD]413.5[/TD]
[TD]156[/TD]
[TD]67.5[/TD]
[TD]70[/TD]
[TD]120[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fat[/TD]
[TD]21.5[/TD]
[TD]10[/TD]
[TD]4.5[/TD]
[TD]0[/TD]
[TD]7[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cholesterol[/TD]
[TD]415.25[/TD]
[TD]374[/TD]
[TD]11.25[/TD]
[TD]0[/TD]
[TD]30[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sodium[/TD]
[TD]666.5[/TD]
[TD]124[/TD]
[TD]112.5[/TD]
[TD]10[/TD]
[TD]420[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Potassium[/TD]
[TD]126[/TD]
[TD]126[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Carbohydrates[/TD]
[TD]16.75[/TD]
[TD]0[/TD]
[TD]0.75[/TD]
[TD]16[/TD]
[TD]0[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Protein[/TD]
[TD]29.55[/TD]
[TD]12[/TD]
[TD]5.25[/TD]
[TD]0.3[/TD]
[TD]12[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
------------------------------------------------------------------------------------------------------------------------------------------
The food group row selections are populated by selecting from a dropdown list, and the Food item dropdown list is then populated based on the foodgroup selection (So if Proteins is selected as the food group you will only get protein options to fill in the Food Items cell). Then the values for calories, fat, etc, are automatically looked up and selected from the proper lists on sheet 2.
Here is an example of Sheet 2:
-----------------------------------------------------------------------------------------------------------------------------------------
[TABLE="width: 394"]
<tbody>[TR]
[TD]Proteins[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Food Item[/TD]
[TD] 1. Egg[/TD]
[TD] 2. Tuna[/TD]
[TD] 3. Bacon[/TD]
[/TR]
[TR]
[TD]Calories[/TD]
[TD="align: right"]78[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]60[/TD]
[/TR]
[TR]
[TD]Fat[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]0.5[/TD]
[TD="align: right"]3.5[/TD]
[/TR]
[TR]
[TD]Cholesterol[/TD]
[TD="align: right"]187[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]15[/TD]
[/TR]
[TR]
[TD]Sodium[/TD]
[TD="align: right"]62[/TD]
[TD="align: right"]180[/TD]
[TD="align: right"]210[/TD]
[/TR]
[TR]
[TD]Potassium[/TD]
[TD="align: right"]63[/TD]
[TD="align: right"]90[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Carbohydrates[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Protein[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]6[/TD]
[/TR]
</tbody>[/TABLE]
------------------------------------------------------------------------------------------------------------------------------------------
The items in the "Food Item" row are in a named range called "Proteins", and the items in the Calories row are in a named range called "ProteinsCalories", the Fat row items in a named range called "ProteinsFat", etc...
So in sheet 1 when I select "Proteins" and "1. Eggs" for the first food item, I need to do a lookup to go grab the value for the calories for eggs listed on sheet 2.
I am wondering if there is a way to do that for all the different food groups using a dynamic lookup instead of using a bunch of nested IF statements for all the different food groups, which is what I currently have...
Is there any way to put in something like this:
=LOOKUP(C70,C69,C69&A72)
(Note that C70 is the "1. Eggs" Selection from a dropdown, C69 is the "Proteins" selection from a dropdown, and A72 is the cell labeled "Calories")
To make it easier to read for you, that essentially translates into: =LOOKUP(1. Eggs, Proteins, ProteinsCalories)
The only problem is that I don't know how to get excel to recognize that the lookup vector and results vector in the formula should be seen as named ranges on sheet 2 as opposed to simple cell references like I have selected.
Right now I have this formula (which works but is very convoluted)(Note that C71 is the "# servings" cell):
=C71*IF(C69="Proteins",LOOKUP(C70,Proteins,ProteinsCalories),IF(C69="Dairy",LOOKUP(C70,Dairy,DairyCalories),IF(C69="Vegetables",LOOKUP(C70,Vegetables,VegetablesCalories),IF(C69="Fruits",LOOKUP(C70,Fruits,FruitsCalories),LOOKUP(C70,Grains,GrainsCalories)))))
Essentially what this boils down to is does anyone know how to conglomerate two cells into a string that can then be recognized as a named range to be used in a lookup function?
Thanks in advance for any help you can provide!