+ Reply to Thread
Results 1 to 3 of 3

Formula needs to change based on a cell value

  1. #1
    Registered User
    Join Date
    04-21-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    Office 365
    Posts
    1

    Formula needs to change based on a cell value

    Hi all,

    I am trying to write a formula that uses data from a table, however there are multiple tables, and the correct one to be used is based on what is entered in a specific cell. I have attached the example worksheet - I have the basic formula in cell D28, and my attempt at a more complex version in cell D32, but I don't know how to extend it to cover all four different data tables without using a load of IF functions. Maybe some sort of LOOKUP function? Any help would be appreciated.

    Thanks,

    Ruth
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,458

    Re: Formula needs to change based on a cell value

    OK - this can be done easily, as you already have named ranges (tables). If you are happy to create two hidden cells (let's say N8 and N9, then hide the column), we can do this:

    N8: =LOOKUP(Limit,{200,220,240,250},{"table_200_pa","table_200_pa","table_200_pa","table_200_pa"})
    N9: =LOOKUP(Limit,{200,220,240,250},{"flow_200_pa","flow_200_pa","flow_200_pa","flow_200_pa"})

    Then in D28:

    =INDEX(INDIRECT(N8),MATCH(C28,INDIRECT(N9),-1),2)
    Last edited by AliGW; 04-21-2017 at 08:31 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula needs to change based on a cell value

    I used INDEX's rarely used optional 4th argument for "Area"

    First I created a named range called MyTables
    (just selecting all the ranges while holding down the control key) Then going to Define Name

    In D25, with the value in C25

    =INDEX(MyTables, MATCH(C25, INDEX(MyTables,,1,MATCH(C8, {200,220,240,250},0)),-1),2,MATCH(C8, {200,220,240,250},0))
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ 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. Change formula based on cell value
    By Groovicles in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-22-2016, 02:00 PM
  2. change formula based on cell value
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 06-03-2015, 05:00 PM
  3. Replies: 2
    Last Post: 02-01-2013, 01:57 PM
  4. Replies: 1
    Last Post: 12-19-2012, 05:29 PM
  5. [SOLVED] Formula question-change formula based cell calling it?
    By seethesun in forum Excel General
    Replies: 2
    Last Post: 02-08-2009, 01:39 PM
  6. Change formula based on Cell Value
    By Johndrew in forum Excel General
    Replies: 2
    Last Post: 04-22-2007, 08:12 AM
  7. [SOLVED] Change cell in formula based on date
    By Skillet in forum Excel General
    Replies: 3
    Last Post: 10-27-2005, 08:05 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