+ Reply to Thread
Results 1 to 5 of 5

Change reference cell in formula based on selection in drop down list

  1. #1
    Registered User
    Join Date
    06-10-2016
    Location
    Strathroy, Ontario
    MS-Off Ver
    2016
    Posts
    2

    Change reference cell in formula based on selection in drop down list

    I'm working on a way to estimate gas costs for a trip.

    This is the formula:

    G = Gas Use Estimate
    D = Distance to Travel
    M = MPG (no load)
    W = Load Weight

    G = D / (M - (W / 100) X (M/100))


    This formula gives me an estimate of how many Gallons gas I will need to make the trip there. Now I change the type of vehicle using a drop down list. I wonder if there is anyway that I can tell Excel to change the M value based on what vehicle is selected in the drop down list..

    If cell A1 is car type1 in the drop down list and cell B1 car type1 MPG (no load)
    If cell A2 is car type2 in the drop down list and so on.

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Change reference cell in formula based on selection in drop down list

    you can replace the M with a lookup...something like lookup(A1,{"car type 1","car type 2"},{5,10})

    G = D / (lookup(A1,{"car type 1","car type 2"},{5,10}) - (W / 100) X (lookup(A1,{"car type 1","car type 2"},{5,10})/100))
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Registered User
    Join Date
    06-10-2016
    Location
    Strathroy, Ontario
    MS-Off Ver
    2016
    Posts
    2

    Re: Change reference cell in formula based on selection in drop down list

    Right on, this is good stuff to know. Apparently my understanding of it is a little off tho.. Here's how I'm interpreting it:

    - (lookup(A1,{"car type 1","car type 2"},{5,10}) -

    this is telling Excel to analyze the data in cell A1 (this is the cell with the drop down list where I select the vehicle type).
    The formula continues: if A1 contains the txt "car type 1" the value of M is 5, if A1 = "car type 2" the value is 10.

    Using this understanding I came up with the following formula:

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


    This formula returns incorrect values:

    When Small Delivery Vehicle is selected it returns a value of: 96.36363636
    When Medium Delivery Vehicle is selected it returns a value of: 35.3333333
    When Large Delivery Vehicle is selected it returns a value of: #N/A

    Perhaps someone is catching my error?

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Change reference cell in formula based on selection in drop down list

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

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,900

    Re: Change reference cell in formula based on selection in drop down list

    Change:

    =LOOKUP(N31,{"Small Delivery Vehicle","Medium Delivery Vehicle","Large Delivery Vehicle"},{40,15,5.5})

    To:

    =CHOOSE(MATCH(N31,{"Small Delivery Vehicle","Medium Delivery Vehicle","Large Delivery Vehicle"},0),40,15,5.5)

+ 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: 1
    Last Post: 06-25-2015, 07:29 AM
  2. Change cell content depending on selection from drop down list
    By mack4n in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-16-2015, 04:17 AM
  3. Replies: 1
    Last Post: 04-03-2015, 06:00 PM
  4. Replies: 2
    Last Post: 07-15-2014, 08:24 PM
  5. Can a worsheet formula reference a drop down list selection?
    By 2Excel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-09-2014, 04:48 AM
  6. [SOLVED] Reference another worksheet, based on the drop down selection of another cell
    By VTX in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-25-2013, 11:27 AM
  7. Replies: 1
    Last Post: 04-12-2013, 06:27 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