+ Reply to Thread
Results 1 to 5 of 5

If function with many, many conditions

  1. #1
    Registered User
    Join Date
    12-05-2019
    Location
    Denver, CO
    MS-Off Ver
    Office 365
    Posts
    6

    If function with many, many conditions

    I am trying to take what in Sheet1 Cell C2 and move the data to match from Sheet 2. So if I put on $132,000 it would use the column of data on Sheet Two for 100,000 - 150,000 if I put in $31,560 it would use the column of data for $30,000 to $39,999.

    Here is the formula I have so far. Tell me where I messed up!

    =IF($C$2>="15,000",Sheet2!D4,IF($C$2<="$30,000",Sheet2!E4,IF($C$2<="$40,000",Sheet2!F4,IF($C$2<="$50,000",Sheet2!G4,IF($C$2<="$70,000",Sheet2!H4,IF($C$2<="$100,000",Sheet2!I4,IF($C$2<="$150,000",Sheet2!J4,IF($C$2<"200,000",Sheet2!K4,Sheet2!C4))))))))

    Can someone re-write the formula correctly for me?
    Attached Files Attached Files
    Last edited by thefinu; 12-06-2019 at 04:43 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: If function with many, many conditions

    Se if lookup works for you.

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


    Start in C5 and drag down.

  3. #3
    Registered User
    Join Date
    12-05-2019
    Location
    Denver, CO
    MS-Off Ver
    Office 365
    Posts
    6

    Re: If function with many, many conditions

    davesexcel,

    your solution has gotten me the furthest, but at cell 13 it uses the $200,000 value and then the rest are zeros. I updated the attachment to reflect the change I made.

    How do I fix this?

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,496

    Re: If function with many, many conditions

    just an FYI, the formula you gave in post #1...
    =IF($C$2>="15,000",Sheet2!D4,IF($C$2< ="$30,000",Sheet2!E4,IF($C$2< ="$40,000",Sheet2!F4,IF($C$2< ="$50,000",Sheet2!G4,IF($C$2< ="$70,000",Sheet2!H4,IF($C$2< ="$100,000",Sheet2!I4,IF($C$2< ="$150,000",Sheet2!J4,IF($C$2< "200,000",Sheet2!K4,Sheet2!C4))))))))
    would not work because of a couple reasons.

    The reason is that commas have a special purpose in a formula as do dollar signs and quotes. The quotes around the dollar amounts are causing the formula to consider those amounts text but you are referencing a number so the quotes mean the formula will not recognize the number and compare it to the text. The dollar sign is usually used to lock in a cell in some way, in your formula you have the dollar sign, I'm assuming because you have the cell C2 formatted to look like currency but if you click on C2 it only shows a number, no dollar sign. The commas in the dollar amounts in your formula are making excel think the 200,000 the part after the comma is the false part of the if then statement.

    This should be how that formula should look...
    =IF($C$2>=15000,Sheet2!D4,IF($C$2< =30000,Sheet2!E4,IF($C$2< =40000,Sheet2!F4,IF($C$2< =50000,Sheet2!G4,IF($C$2< =70000,Sheet2!H4,IF($C$2< =100000,Sheet2!I4,IF($C$2< =150000,Sheet2!J4,IF($C$2< 200000,Sheet2!K4,Sheet2!C4))))))))

    Next, your note to Dave about not handling 200000 or more and that in cell 13, I do not see any 200,000 value in either sheet for any cell in row 13. If I put in 200001 in C2 of CES tab all the values in the CES tab update. Can you give more information about how and where the formula fails?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: If function with many, many conditions

    I would correct the layout on both sheets to only use 1 column for the left hand categories, then resort to a simple INDEX/MATCH/MATCH:

    =INDEX(Sheet2!$A$1:$J$34, MATCH($A5, Sheet2!$A$1:$A$34,0), MATCH(CES!$B$2, Sheet2!$A$1:$J$1,1))
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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] if multiple conditions are met, perform sum function using index function
    By billrogers184 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-31-2018, 02:49 PM
  2. Replies: 2
    Last Post: 01-14-2016, 03:53 PM
  3. Using Now function with IF conditions
    By Sameer Verma in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-28-2014, 03:22 PM
  4. [SOLVED] Satisfying 2 conditions using if function or other function
    By aparunkumar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-22-2013, 12:19 PM
  5. [SOLVED] IF function with 2 conditions
    By gjrr4x1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-14-2013, 06:17 AM
  6. IF function with 2 conditions
    By mishii in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-07-2012, 05:51 PM
  7. [SOLVED] Two Conditions Function
    By Freshman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11: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