Calorie Tracking with Spreadsheets: Automating Recipe Calories

  • Thread starter Thread starter FrogPad
  • Start date Start date
  • Tags Tags
    Calories Tracking
Click For Summary

Discussion Overview

The discussion revolves around automating calorie tracking in spreadsheets using formulas. Participants explore methods to link ingredient names to their corresponding nutritional values in a structured format, focusing on the use of functions like VLOOKUP for this purpose.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant describes a spreadsheet setup with ingredients and their calorie counts, seeking a way to automate calorie totals based on recipe ingredients.
  • Another participant questions the need for duplicating values in the spreadsheet, suggesting a simpler approach by directly referencing calorie counts.
  • A suggestion is made to use the VLOOKUP function to automate the retrieval of calorie information based on ingredient names.
  • The original poster expresses a desire for a "database" of grocery items and recipes, indicating a preference for a straightforward solution over developing a full program.
  • The original poster thanks participants for their input, indicating that the suggestions align with their needs.

Areas of Agreement / Disagreement

Participants generally agree on the use of VLOOKUP as a potential solution, but there is a lack of consensus on the necessity of duplicating values in the spreadsheet.

Contextual Notes

The discussion does not resolve the potential limitations of using VLOOKUP, such as its dependency on the structure of the data and the need for exact matches.

FrogPad
Messages
801
Reaction score
0
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 let's 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.
 
Computer science news on Phys.org
hmmmmm... "=B2" but why would you want to have the same value twice??
 
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.
 

Similar threads

  • · Replies 21 ·
Replies
21
Views
26K
  • · Replies 6 ·
Replies
6
Views
25K
  • · Replies 28 ·
Replies
28
Views
4K
Replies
14
Views
6K
  • · Replies 37 ·
2
Replies
37
Views
5K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
6
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K