# Excel Problem

Lets say I have the following spreadsheet.

Code:
     A              B            C            D            E
1   Ingredient  Calories    Protein     Recipe     Calories
2   Banana      100         1             =A2        ?
Now what I want to do is lets say I click on cell D2 and type "=A2" (without quotes of course). What happens is that D2 would then equal "Banana". How could I automatically make E2 fill in the appropriate amount of calories for banana?

I hope the way I worded this question makes sense.

Related Computing and Technology News on Phys.org
hmmmmm.... "=B2" but why would you want to have the same value twice??

rcgldr
Homework Helper
You probably want to use the VLOOKUP function. This function searches for a match (exact or range compare) in one column, then returns a value correspoding to the same row in another column.

Anttech said:
hmmmmm.... "=B2" but why would you want to have the same value twice??
I want it to be automated.

I want a "database" of different grocery items with some stats attached to them. For example,

Code:
Item       Calories   Protein   Carbohydrates   Fat
Soy Milk   100        6          9                     3
Banana    110        1          32                    0
Chicken    120        24        0                     0
Then I want another "database" of recipes. Each recipe will consist of items taken from the grocery list. So, for example if I wanted to create a recipe item such as a banana shake I would just click under recipe, and then in the items list I would add the items by typing =XX where XX is the cell that I clicked on with the recipe name.

Code:
Recipe                  Calories    Protein   Carbohydrates  Fat
Banana Shake

Soy Milk                100        6          9                     3
Soy Milk                100        6          9                     3
Banana                 110        1          32                    0

Total                    310        13        50                    6
I'm doing it this way because I don't have the time to put together a "real" program to do this. Hopefully this will suite my needs. It's going to be dirty, but oh well :)

Jeff Reid said:
You probably want to use the VLOOKUP function. This function searches for a match (exact or range compare) in one column, then returns a value correspoding to the same row in another column.
Thank you! Thank you! Thank you!

That's exactly what I wanted. Mercy.