+ Reply to Thread
Results 1 to 5 of 5

IF, THEN scenario (I think) help, please... Thanks!

  1. #1
    Registered User
    Join Date
    06-10-2012
    Location
    Eugene
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question IF, THEN scenario (I think) help, please... Thanks!

    Hi,

    I've just made a large list of data (all on one sheet) with four columns of info pertaining to each item in the list. The entire spreadsheet is formatted as text. I am now trying to create a calculator that will pull data from one of those columns based on the item chosen. For example:

    This is a small sample of my list:

    ITEM PROT CARB FATS CALORIES
    Pineapple 5 5 5 15
    Berries 8 8 8 24
    Yogurt 3 3 3 9
    Granola 4 4 4 12

    What I want to achieve:

    I am trying to be able to select random items that make up a recipe and have the calorie totals list out so I can get grand total calories for the entire recipe.

    Basically.....

    If I want to make a 'meal' of pineapple, granola and yogurt and find the total of the three, I want to go to a cell, type in pineapple and have 15 show up in the next cell automatically and I want to be able to do that with all three, or as many ingredients required to make a 'meal' or 'recipe' so that the totals show up and can be grand totaled at the bottom.

    Hope that's not as clear as mud.

    I tried using an "IF/THEN" scenario but I couldn't make it work. Such as.... "IF" I tell the new cell to equal the text in the cell that says Pineapple, "THEN" 15 shows up in the adjacent cell. And so on for each item in the list.

    Help is greatly appreciated!!

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: IF, THEN scenario (I think) help, please... Thanks!

    Have a look at the VLOOKUP() function. Here's a link: http://www.excelfunctions.net/ExcelVlookup.html

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,944

    Re: IF, THEN scenario (I think) help, please... Thanks!

    try the attached. It uses data validation to make sure you enter/spell the food type right - add new items in the left table, select items from the right table. I took all ranges down to row 200, so if your list gets longer than that, you will have to extend them.

    let me know if this something you can work with or if you have any other questions?
    Attached Files Attached Files
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    06-10-2012
    Location
    Eugene
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: IF, THEN scenario (I think) help, please... Thanks!

    Hi,

    Thanks for that!! You've got me on the right track and Example 1 should, in theory, do exactly what I am looking for, however I cannot get it to work. UGH. What might I be doing wrong??? Is it because my entire sheet is formatted as text?

    Thanks,
    Michele

  5. #5
    Registered User
    Join Date
    06-10-2012
    Location
    Eugene
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: IF, THEN scenario (I think) help, please... Thanks!

    Hi again... I just answered my own question. YES, it was because my formula column was formatted as 'Text'. I changed it to 'General' and voila!!

    THANK YOU SO MUCH!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1