+ Reply to Thread
Results 1 to 5 of 5

Lookup function within IF statement?

  1. #1
    Registered User
    Join Date
    11-12-2009
    Location
    United States
    MS-Off Ver
    Excel 2010 (or Excel 2003)
    Posts
    24

    Lookup function within IF statement?

    Sample included.

    In C2, I need a formula that looks at B2, compares it to the table in E:F, and returns an 'X' if the value is 3 or bigger, otherwise, enter nothing.

    In my primitive programming mind, I 'wanted' to do something like:

    =if(lookup(B2,$E$2:$F$6>2),"X","")

    I had a similar solution I was helped with -- used a sumproduct function, which worked great. This one is a little different as it checks a condition, then returns a different value.

    I could solve my issue by entering another column that first performs the lookup, returns the value, and then use an if function to return "X" from that new column, but I figure there has to be a way to avoid an extra formula and take two steps at once.

    Thanks for your help.
    Attached Files Attached Files
    Last edited by thumper300zx; 01-25-2011 at 09:04 PM.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Lookup function within IF statement?

    Close

    =IF(VLOOKUP(B2,$E$2:$F$6,2,0)>2,"X","")

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Lookup function within IF statement?

    Hi Cutter,

    Your formula is close, but the OP wants "X" if the value is >= 3


    C2: =IF(VLOOKUP(B2,$E$2:$F$6,2,FALSE)>=3,"X","")
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Lookup function within IF statement?

    Yep, but in the formula he attempted he had >2 so I went with that.

    And the numbers in his sample are integers.

    But given his wording in the question, you're right, thanks.

  5. #5
    Registered User
    Join Date
    11-12-2009
    Location
    United States
    MS-Off Ver
    Excel 2010 (or Excel 2003)
    Posts
    24

    Re: Lookup function within IF statement?

    Ah --- thanks! Much appreciated (marked as solved).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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