+ Reply to Thread
Results 1 to 6 of 6

Nested If AND with VLookup

  1. #1
    Registered User
    Join Date
    09-20-2012
    Location
    Cambridge, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    8

    Nested If AND with VLookup

    =IF(AND(C13<>"Banked Hours (J)",A7=VLOOKUP(A7,Data!Q2:Q36,1,FALSE)),"Unpaid (M)"," ")

    This returns #N/A if the Name in A7 is not in my Vlookup list on my data list (Data!). I just want it to be blank. What am I missing here?

    Thanks!

  2. #2
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Nested If AND with VLookup

    try wrap it with iferror

    =IFERROR(IF(AND(C13<>"Banked Hours (J)",A7=VLOOKUP(A7,Data!Q2:Q36,1,FALSE)),"Unpaid (M)"," "),"")

  3. #3
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Nested If AND with VLookup

    Quote Originally Posted by MrsRobinson View Post
    = What am I missing here?
    Perhaps the IFERROR part..?

    =iferror(IF(AND(C13<>"Banked Hours (J)",A7=VLOOKUP(A7,Data!Q2:Q36,1,FALSE)),"Unpaid (M)"," ");"")
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  4. #4
    Registered User
    Join Date
    09-20-2012
    Location
    Cambridge, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Nested If AND with VLookup

    Clunk...I pulled it out when other cells factored in...never thought to put it back in. thanks so much!!!

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Nested If AND with VLookup

    Vlookup isn't really the best funtion for the task of checking if a value exists in another column..
    Try
    COUNTIF(Data!Q2:Q36,A7)>0

    This way, Countif doesn't error if the value doesn't exist at all, so no need for iferror
    =IF(AND(C13<>"Banked Hours (J)",COUNTIF(Data!Q2:Q36,A7)>0),"Unpaid (M)"," ")

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Nested If AND with VLookup

    Quote Originally Posted by MrsRobinson View Post
    Clunk...I pulled it out when other cells factored in...never thought to put it back in. thanks so much!!!


    ........................

  7. #7
    Registered User
    Join Date
    09-20-2012
    Location
    Cambridge, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Nested If AND with VLookup

    Jonmo1 & Fotis - thanks to both - both solutions work.

+ 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