+ Reply to Thread
Results 1 to 8 of 8

Return variable value based on drop-down

  1. #1
    Registered User
    Join Date
    01-07-2013
    Location
    Boise
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Return variable value based on drop-down

    Hello everyone. First off I would like to thank you in advance for your help. Second of all the project I am working on contains sensitive information so I cannot be exact with some of the things I am describing.

    So here is what I am trying to do.
    I need cell F5 on the sheet "Extra Work" to automatically be filled with the price of a particular service that is named by a drop down box on the same sheet in cell D5. Since the price varies by location the formula needs to only fill in the price of the service according to what the user enters as his region. The user will select his region name in cell G2 from a drop down box on the sheet "inputs". The table of prices for each region is on the sheet "pricing". The names of the regions are on the "pricing" sheet from cells A3 to A21. The names of the services are in cells B2 to AF2 on the same sheet. Something like this:

    --------------Service 1--Service 2--Service 3--Service 4
    Region A------$10-------$22--------$34-------$14
    Region B------$9--------$21--------$33-------$13
    Region C------$13-------$25--------$36-------$16
    Region D------$11-------$23--------$36-------$15

    So basically I need a formula that enters a price automatically depending on the service and the region it was performed in. Unfortunately I am in over my head here . Thanks again for your help.
    Last edited by FDibbins; 01-07-2013 at 11:03 PM. Reason: Updated title

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Need Complex Formula - MS Excel 2010

    We would love to help you with your query, but first, before we can proceed, please see our Forum Rules #1 about proper thread titles and adjust accordingly...

    • To change a Title on your post, click EDIT then Go Advanced.
    • If 2 days have passed, ask a moderator to do it for you.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    01-07-2013
    Location
    Boise
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Need Complex Formula - MS Excel 2010

    That is my bad. Sorry about that. If this new thread title still does not adhere to the forum rules I am open to suggestions.

    Also just in case anyone is wondering why I didn't post the workbook it's because if corporate found out that I put that information online I would be fired and possibly sued. Thanks for understanding.

  4. #4
    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
    53,049

    Re: Return variable value based on drop-down

    Assumning your data is in A1:E5, including headings and row names, and you have the Servive drop-down in G1 and the Region dropdown in H1, use this...

    =INDEX($A$1:$E$5,MATCH($H$1,$A$1:$A$5,0),MATCH($G$1,$A$1:$E$1,0))
    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

  5. #5
    Registered User
    Join Date
    01-07-2013
    Location
    Boise
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Return variable value based on drop-down

    Much appreciated. This formula works well but it is not perfect. It will sometimes match a price to the wrong region. Also 1 region won't work at all. No matter what service I pick it just shows "#REF!"

    Another region will show "-" on most of its services.

    To the best of my knowledge I have used the formula you provided on a larger scale. Here is the actual formula I am using
    Please Login or Register  to view this content.
    Any ideas?

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Return variable value based on drop-down

    Well first thing I see, the ranges overlap each other. This could be causing a problem, but overall, the formula FD provided seems the right way to go...

    I understand your file contains sensitive information, but could you not put together a sample test file.

    Based on the requirements from post #1, maybe...

    =INDEX($B$3:$AJ$22,MATCH(Inputs!$G$2,$A$3:$A$22,0),MATCH('Extra work'!$D$5,$B$2:$AJ$2,0))

  7. #7
    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
    53,049

    Re: Return variable value based on drop-down

    Thanks jeff.

    @ MrNewb, its hard to develop anything when all you have to go on are a few lines of info copied here I may have some of theranges a little off, so try adjusting them a bit?

  8. #8
    Registered User
    Join Date
    01-07-2013
    Location
    Boise
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Return variable value based on drop-down

    That did the trick, you guys are awesome! I never would have figured all that out on my own.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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