+ Reply to Thread
Results 1 to 9 of 9

nested ifs error

  1. #1
    Registered User
    Join Date
    11-21-2021
    Location
    Orlando, FL
    MS-Off Ver
    16.54 Mac (21101001)
    Posts
    3

    nested ifs error

    I can't seem to figure out why my nested if with AND formula isn't working. I'll explain it in words and hopefully you can help me out:

    1) If value in cell A12 matches value in the vlookup formula AND
    2) each of the values in the following cells C12,D12,H12,I12,AC12,AE12,AF12,BD12,BF12,CB12,CX12 is greater than zero, then return the value YES,
    3) If If value in cell A12 matches value in the next vlookup formula AND
    4) each of the values in the following cells C12,D12,O12,P12,AL12,AM12,AN12,AO12,BL12,BM12,BN12,CI12,CJ12,DE12 is greater than zero, then return the value YES
    5) same goes for the next set of formulas..
    .
    .
    8) Otherwise return blank or NO

    Note: if (2) returns Yes, (4) won't return yes because A12 won't match the new vlookup in (3)

    if(and((vlookup($A12,'Group Info'!$A$14:$D$1026,4,0)=$CW$8),(C12,D12,H12,I12,AC12,AE12,AF12,BD12,BF12,CB12,CX12)>0),"Yes",if(and((vlookup($A12,'Group Info'!$A$14:$D$1026,4,0)=$DD$8),(C12,D12,O12,P12,AL12,AM12,AN12,AO12,BL12,BM12,BN12,CI12,CJ12,DE12)>0),"Yes",if(and((vlookup($A12,'Group Info'!$A$14:$D$1026,4,0)=$dk$8,(C12,D12,V12,AU12,AV12,AW12,AX12,BT12,BU12,BV12,CP12,CQ12,DL12)>0),"YES",""))))


    I keep getting #ERROR! message.

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,201

    Re: nested ifs error

    It's best to always attach a sample file. Please see the yellow banner at the top of the page.

    Also, for your version, when Excel is open, you should be able to click on "File", then "Account" and it should tell you. There are other ways depending on your version so it may be different for you.

    Lastly, for your IF statement, for the AND portion, you need to put the expression for EACH cell, in other words:

    C12>0,D12>0,H12>0, etc.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,716

    Re: nested ifs error

    Administrative Note:

    Members will tailor the solutions they offer to the version of Office (Excel) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: nested ifs error

    I agree with the above a sheet would be much easier but (C12,D12,H12,I12,AC12,AE12,AF12,BD12,BF12,CB12,CX12)>0 is likely to error.


    min(C12,D12,H12,I12,AC12,AE12,AF12,BD12,BF12,CB12,CX12)>0 may be a replacement that works and perhaps slightly shorter than Greg's suggestion, but he correctly identifies an error

    Also will the lookup always find something even if it is not equal? or will it find nothing and produce an error?
    What is the value being matched is it a number or could it be text?

  5. #5
    Registered User
    Join Date
    11-21-2021
    Location
    Orlando, FL
    MS-Off Ver
    16.54 Mac (21101001)
    Posts
    3

    Re: nested ifs error

    Thanks gregb11, aligw and davsth,
    I changed the formula as suggested to this now:
    if(and(vlookup(A11,'Group Info'!$A$14:$D$1026,4,0)=$CW$8),(C11>0,D11>0,H11>0,I11>0,AC11>0,AE11>0,AF11>0,BD11>0,BF11>0,CB11>0,CX11>0)),"Yes",if(and((vlookup(A11,'Group Info'!$A$14:$D$1026,4,0)=$DD$8),(C11>0,D11>0,O11>0,P11>0,AL11>0,AM11>0,AN11>0,AO11>0,BL11>0,BM11>0,BN11>0,CI11>0,CJ11>0,DE11>0),"Yes",if(and((vlookup(A11,'Group Info'!$A$14:$D$1026,4,0)=$dk$8,(C11>0,D11>0,V11>0,AU11>0,AV11>0,AW11>0,AX11>0,BT11>0,BU11>0,BV11>0,CP11>0,CQ11>0,DL11>0),"Yes","")))))

    but no difference, I think I probably messed up the brackets now entirely.

    The lookup should always find something based on the attached example. Value being matched is a text.
    I found the Ms version for mac that I am using 16.54 (21101001)
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,953

    Re: nested ifs error

    Please Login or Register  to view this content.
    named range-->
    ID.Sets ='Group Info'!$A$14:INDEX('Group Info'!$D:$D,MATCH("zzzzz",'Group Info'!$D:$D))
    Last edited by protonLeah; 11-22-2021 at 09:13 PM.
    Ben Van Johnson

  7. #7
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    3,201

    Re: nested ifs error

    I didn't really look into the logic, but I just re-adjusted your formula based on how I think you want it to work. In my thinking, you had some parentheses improperly placed. Maybe this?

    =IF(AND(VLOOKUP(A11,'Group Info'!$A$14:$D$1026,4,0)=$CW$8,C11>0,D11>0,H11>0,I11>0,AC11>0,AE11>0,AF11>0,BD11>0,BF11>0,CB11>0,CX11>0),"Yes",IF(AND(VLOOKUP(A11,'Group Info'!$A$14:$D$1026,4,0)=$DD$8,C11>0,D11>0,O11>0,P11>0,AL11>0,AM11>0,AN11>0,AO11>0,BL11>0,BM11>0,BN11>0,CI11>0,CJ11>0,DE11>0),"Yes",IF(AND(VLOOKUP(A11,'Group Info'!$A$14:$D$1026,4,0)=$DK$8,C11>0,D11>0,V11>0,AU11>0,AV11>0,AW11>0,AX11>0,BT11>0,BU11>0,BV11>0,CP11>0,CQ11>0,DL11>0),"Yes","")))

  8. #8
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: nested ifs error

    Who knows you were not just looking for a consolidation?

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

  9. #9
    Registered User
    Join Date
    11-21-2021
    Location
    Orlando, FL
    MS-Off Ver
    16.54 Mac (21101001)
    Posts
    3

    Re: nested ifs error

    Such a good idea to clean up the code with named ranges, thank you!

+ 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] #VALUE! Error Using a Triple Nested SUBSTITUTE Formula, ERROR DUE TO EMPTY CELL(S)
    By skite0 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-23-2021, 04:13 PM
  2. [SOLVED] Value Error (nested IF)
    By Median in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-05-2018, 11:02 AM
  3. Nested IF statement error. Nested True statement is not triggering
    By Lucas7040 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2016, 11:41 AM
  4. Next without For error in nested loop - Escaping a Nested Loop?
    By BeneRich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2012, 06:38 PM
  5. Nested if gives #Name? Error
    By Traymond in forum Excel General
    Replies: 2
    Last Post: 01-13-2011, 09:10 PM
  6. Nested if error
    By Bryguy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2007, 09:16 AM
  7. Nested IF error
    By Ricardo Monteiro :^) in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-05-2006, 04:45 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