+ Reply to Thread
Results 1 to 7 of 7

Execute different equations based on the value of a single cell

  1. #1
    Registered User
    Join Date
    06-24-2016
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    7

    Execute different equations based on the value of a single cell

    Hi,

    New to the forum. Did a quick search for other threads on my topic but couldn't find anything so apologies if this is a duplicate question.

    I am trying to insert specific values to complete an equation based on the value of a singe cell. I have attached images to aid my explanation.

    For example in the images attached you will see that I have three columns I am pulling information from and multiplying by specific values to get my end total.

    The values that I am using to multiply by, in this case 500, 400 & 600 the low end spectrum of my market.

    What i would like to do is create an additional column with say a value of 1,2 or 3 (corresponding to the Low, Medium and High levels of my market) that would automatically insert different multiplication values for the end total.

    For example. If I were to enter a 2 in the additional column, instead of multiplying by 400, 500 nd 600, it would multiply by 450, 550 and 650 ect...

    Any help would be appreciated.

    excel 2.jpg

    excel 1.jpg

  2. #2
    Forum Contributor
    Join Date
    03-17-2005
    Location
    Canterbury, Kent
    MS-Off Ver
    2003, 2010
    Posts
    285

    Re: Execute different equations based on the value of a single cell

    Not sure if this is what you want....

    depending on how many different values you are multiplying by you could try using the IF function, if you have more than a couple then a LOOKUP of some sort.

    First part of your existing formula would start: =IF(S105=2,O105*450,O105*400) You can then add subsequent IF statements.

    Using a VLOOKUP it would start: =IFERROR(O105*VLOOKUP(S105,$T$105:$U$107,2,FALSE),"")

    S105 is the additional column you mentioned, range T105:U107 is the lookup table.

    A sample workbook is better to work from than images.

    Windy

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Execute different equations based on the value of a single cell

    Create a table in Sheet2 of the different bands and multipliers,e.g. 3 rows 4 columns

    1 500 400 600 Low
    2 450 550 650 Medium
    3 700 800 900 High

    Then use VLOOKUP based on the Low Medium High band (presumably 1,2,3) looking at that table and multiplying by the relevant row.
    Assume Rooms and Pricing value are on Sheet1 Row 2 with the E1 is the band 1 2 or 3.

    in Sheet1!D2
    =VLOOKUP(E1,Sheet2!A1:D3,2,0)*A2+VLOOKUP(E1,Sheet2!A1:D3,3,0)*B2+VLOOKUP(E1,Sheet2!A1:D3,4,0)*C2
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    06-24-2016
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    7

    Re: Execute different equations based on the value of a single cell

    Hi,

    Thank you both for you replies. I chose to go with Special K's method because it seemed a bit more straight forward.



    Special K,

    I believe I have followed your directions correctly however, I am still getting an error for the final value. I can not post my sample work book so I've had to use images again to show what I've done.

    Sheet 1
    excel 1.jpg


    Sheet 2
    excel 2.jpg

    Thank you for your help. Much appreciated.

    Frank

  5. #5
    Forum Contributor
    Join Date
    03-17-2005
    Location
    Canterbury, Kent
    MS-Off Ver
    2003, 2010
    Posts
    285

    Re: Execute different equations based on the value of a single cell

    As per your original post all the cells were multiplied: O105*500 P105*400 & Q105*600
    The vlookup formula is doing the same, only looking for what to multiply by first.
    If 1 is placed in E1 then it return A2*500, B2*400 & C2*600 =2300, change the number in E1 to 2 then it return A2*450, B2*550 & C2*650 =2800
    Windy

  6. #6
    Registered User
    Join Date
    06-24-2016
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    7

    Re: Execute different equations based on the value of a single cell

    Hi Windy,

    The main problem is that no number appears. When I enter the vlookup code into the cell it returns an NA value. I only clicked on the cell to show the code.

    Thanks,

    Frank

  7. #7
    Forum Contributor
    Join Date
    03-17-2005
    Location
    Canterbury, Kent
    MS-Off Ver
    2003, 2010
    Posts
    285

    Re: Execute different equations based on the value of a single cell

    Use the IFERROR function which you can specify what will be returned if no match found.

    For example:
    =IFERROR(VLOOKUP(E1,Sheet2!A1:D3,2,0)*A2+VLOOKUP(E1,Sheet2!A1:D3,3,0)*B2+VLOOKUP(E1,Sheet2!A1:D3,4,0)*C2,"")

    This will return a blank if no match found.

    Change the "" at the end to what you want returned example "No match"

    Windy

+ 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. [SOLVED] Auto-select cell ranges based on x column value to execute formula
    By jb257 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-04-2014, 03:22 AM
  2. [SOLVED] Extract single cell data based on a single cell entry
    By farmerdoode in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2013, 11:11 PM
  3. Execute Now fomula based on text in another cell
    By Joker757 in forum Excel General
    Replies: 2
    Last Post: 05-02-2012, 08:20 AM
  4. Write Cell Equations based on Userform selection
    By canyon289 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2011, 02:48 AM
  5. Execute code based on cell entry
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-29-2009, 01:38 PM
  6. [SOLVED] How do I execute a macro based on the value of a cell in Excel?
    By brettopp in forum Excel General
    Replies: 12
    Last Post: 06-16-2006, 08:30 PM
  7. Execute Events Based Upon Selected Cell
    By D.Parker in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-22-2005, 11:07 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