+ Reply to Thread
Results 1 to 5 of 5

Vlookup and IF statments

  1. #1
    Registered User
    Join Date
    10-10-2014
    Location
    Ireland
    MS-Off Ver
    2013
    Posts
    37

    Vlookup and IF statments

    Hi,

    Im trying to use the Vlookup function with IF conditions for the array but to no avail:

    =VLOOKUP(A198,IF(AND(Dashboard!R2="Revenue",Dashboard!T2="10x10"),$A$42:$N$51,IF(AND(Dashboard!R2="Revenue",Dashboard!T2="5x5"),$A$91:$N$100,IF(AND(Dashboard!R2="Revenue",Dashboard!T2="5x20"),$A$139:$N$148,IF(AND(Dashboard!R2="Units",Dashboard!T2="10x10"),$A$58:$N$67,IF(AND(Dashboard!R2="Units",Dashboard!T2="5x5"),$A$107:$N$116,IF(AND(Dashboard!R2="Units",Dashboard!T2="5x20"),$A$155:$N$164,IF(AND(Dashboard!R2="Price",Dashboard!T2="10x10"),$A$74:$N$83,IF(AND(Dashboard!R2="Price",Dashboard!T2="5x5"),$A$123:$N$132,IF(AND(Dashboard!R2="Price",Dashboard!T2="5x20"),$A$171:$N$180,""))))))))),6,FALSE)

    is there a limit on the amount of IF's that can be used. I would also like to use IF's for the Col_index_num can this be done or will i need to use VBA? Should i be putting the Vlookup inside the if statement instead?

    Thanks,
    SPM

  2. #2
    Valued Forum Contributor
    Join Date
    09-09-2009
    Location
    Liverpool, England
    MS-Off Ver
    W: 2021 H: 365
    Posts
    940

    Re: Vlookup and IF statments

    Hi SPM,

    It's always easier to get assistance if you provide an example workbook.

    Regards,

    Snook

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Vlookup and IF statments

    Hi,

    I suggest you upload the workbook so that we can see the request in context. The limit is I believe 64 Ifs but in reality of you ever find yourself using more than half a dozen I'd suggest looking for an alternative solution.

    It doesn't appear that you have a default lookup range if none of the Ifs are true, but upload the workbook for a more considered view.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,144

    Re: Vlookup and IF statments

    I used an INDEX/MATCH based on a table lookup in X2:Y10 on the "Dashboard" sheet (using your VLOOKUP formula as a guide)

    =INDEX($A$42:$N$180,(MATCH(1,(R2=X2:X10)*(T2=Y2:Y10),0)-1)*16+1,6)

    Entered with Ctrl+Shift+Enter

    See the "Dashboard" sheet.

    I have queried the ranges as they appear to be blocks of 16 but appear to skip a row: highlighted in "Dashboard").
    Attached Files Attached Files

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Vlookup and IF statments

    You can also use the CHOOSE function to select the table array as per the conditions like this.......

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

+ 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] Else If Statments VBA
    By mcaviney1987 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2013, 09:47 AM
  2. [SOLVED] IF statments
    By paddock in forum Excel General
    Replies: 2
    Last Post: 12-11-2012, 10:33 PM
  3. Vlookup with nested if statments
    By jamesstorx in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-10-2011, 12:53 PM
  4. Vlookup and If Statments
    By mjhopler in forum Excel General
    Replies: 2
    Last Post: 01-05-2009, 08:02 PM
  5. [SOLVED] IF statments
    By krazygmtrk in forum Excel General
    Replies: 1
    Last Post: 11-05-2008, 07:05 PM
  6. More than 7 if statments
    By eXCELWANNABE in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-24-2008, 06:00 PM

Tags for this Thread

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