+ Reply to Thread
Results 1 to 5 of 5

Multiple nested IF VLOOKUPs

Hybrid View

  1. #1
    Registered User
    Join Date
    06-29-2019
    Location
    Montreal, Canada
    MS-Off Ver
    Office 365
    Posts
    5

    Multiple nested IF VLOOKUPs

    Hi all,

    I use these forums frequently but have never signed up!

    So I'm hoping someone can help, I have a feeling it's simple but I just cant't crack it. I want to nest multiple IF/VLOOKUPs together, I think I've started correctly

    =IF(VLOOKUP(A2,'.com'!A:B,2,FALSE)="NO IP",VLOOKUP(A2,'.co.uk'!A:B,2,FALSE),VLOOKUP(A2,'.com'!A:B,2,FALSE)) But I want to continue this effect for multiple sheets (there are 6 I wish to check),

    i.e if the VLOOKUP doesn't find an IP address in one sheet (well, anything that isn't "NO IP") it checks the next sheet and keeps checking until the end of the workbook, sometimes NO IP may be the final result but I need to check every sheet. I just can't seem to get the syntax right. I've attached the workbook which I hope is clear.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Multiple nested IF VLOOKUPs

    I would list sheet name in C1:H1
    B2
    =INDEX(2:2,MOD(MAX(INDEX(LEN(C2:H2)*100+COLUMN(C2:H2),)),100))
    C2:H2
    =VLOOKUP($A2,INDIRECT("'"&C$1&"'!a:b"),2,)&""
    Attached Files Attached Files

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Multiple nested IF VLOOKUPs

    Perhaps a tidier way:

    With a list of sheets in F1:F6:

    This array formula in C2, copied down:

    =IF(A2="","",IFERROR(VLOOKUP($A2,INDIRECT("'"&INDEX($F$1:$F$6,MATCH(1,--(COUNTIFS(INDIRECT("'"&$F$1:$F$6&"'!A2:A100"),$A2,INDIRECT("'"&$F$1:$F$6&"'!B2:B100"),"<>No IP")>0),0))&"'!A$2:B$100"),2,FALSE),"No IP"))

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Registered User
    Join Date
    06-29-2019
    Location
    Montreal, Canada
    MS-Off Ver
    Office 365
    Posts
    5

    Re: Multiple nested IF VLOOKUPs

    They both work perfectly, thank you. Glenn, would you mind briefly explaining to me how your formula works and why it's better than what I was attempting to do?

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Multiple nested IF VLOOKUPs

    3D searches (multiple sheets) won't work the way you were going about it. The formula makes a 3D array of your 6 sheets and a) looks in A2:A100 for the Server name and b) in B2:b100 for anything that is not "No IP". It returns an array of 0s (no match found for both conditions and a 1 for the sheet matching both conditions. So, in cell C2, it returns (0,0,0,0,0,1) This tells Excel to look in the 6th of the sheets in the list of sheets (.ty) and do the VLOOKUP on that sheet.

+ 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. Nested If and Vlookups
    By lorber123 in forum Excel General
    Replies: 4
    Last Post: 05-18-2014, 12:48 PM
  2. Creating a nested If function with multiple vlookups
    By Symeoni1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-10-2012, 02:53 PM
  3. nested vlookups
    By czoske4 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-11-2011, 02:29 PM
  4. Excel 2008 : Multiple Nested IF/AND/OR & VLOOKUPs
    By damionis in forum Excel General
    Replies: 5
    Last Post: 09-13-2011, 02:58 AM
  5. Nested IFs and VLOOKUPs
    By Johny1 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 09-26-2009, 07:11 AM
  6. Replies: 1
    Last Post: 06-05-2008, 09:01 AM
  7. Nested Vlookups
    By TarekHamouda in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-12-2006, 02:45 AM

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