+ Reply to Thread
Results 1 to 8 of 8

Formula to Return a Value based on 2 Variables

  1. #1
    Registered User
    Join Date
    02-16-2014
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Formula to Return a Value based on 2 Variables

    Hi there,

    I have a spreadsheet that I am trying to get a formula to work for.

    Attached is the sheet.

    In the plans sheet I want to enter the food into column C6 downwards. In each of the cells there is a dropdown menu that links to items on the foods sheet.

    What I would like to do is when one of the dropdown's is slected in the plans sheet the data as listed on the foods sheet related to that appear.

    In cell D6 of the plans sheet I already have some formula that I have used on a previous sheet but some reason this doesn't want to work here.

    Any clever person out there able to explain to me why?

    Thanks in advance for your help!
    Attached Files Attached Files
    Last edited by Howdoesitwork; 01-27-2015 at 05:44 AM.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Help With Formula!

    D6:
    =VLOOKUP($C6,Foods!$B$5:C$10,COLUMNS($B:C),0)

    Copy over and down as needed. Maybe Nest in =IFERROR(formula,"") those aesthetic purposes.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    02-16-2014
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Help With Formula!

    Thanks for the above, this is helpful.

    For the rows that have not been selected these always show #N/A, is there anyway this doesn't have to show if nothing is selected?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,510

    Re: Help With Formula!

    The problem is the merged cells. You need to restructure both worksheets.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    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: Help With Formula!

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    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

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,510

    Re: Formula to Return a Value based on 2 Variables

    When you update your thread title ...


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  7. #7
    Registered User
    Join Date
    02-16-2014
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Help With Formula!

    Hi TMS,

    Thanks for the response.

    However in the attached sheet I have dragged the formula down to the below cells, see attached, but the #N/A still appears?

    Any ideas?

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,510

    Re: Formula to Return a Value based on 2 Variables

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    See the updated example.

    Regards, TMS
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 11
    Last Post: 06-06-2014, 03:34 PM
  2. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 PM

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