+ Reply to Thread
Results 1 to 5 of 5

Nested IF statement with AND conditions

  1. #1
    Registered User
    Join Date
    06-14-2022
    Location
    London
    MS-Off Ver
    2205
    Posts
    2

    Nested IF statement with AND conditions

    Hi Everyone

    I have a datasheet that i want to add a column to based on the combination of what appears in two other columns.

    ie, if columns J and H both say 'Positive', then i want to return 'TP' (True Positive), but if column J had 'Negative' and H was ' Positive', then it would be 'FN' (False Negative) etc.
    photo below for context.
    Excel.PNG

    So effectively, it's 4 IF statements nested into one, but each has an AND as well. The formula ive tried to use is as follows:

    =IF(AND(J2='Positive',H2='Positive'),'TP',IF(AND(J2='Positive',H2='Negative'),'FP',IF(AND(J2='Negative',H2='Negative'),'TN','FN')))

    It just returns an error: There's a Problem with this Formula

    Any help would be greatly appreciated

    TIA
    Last edited by kingcameron; 06-14-2022 at 09:43 AM.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,094

    Re: Nested IF statement with AND conditions

    You need to replace the ' (single quote) with " (double quotes)

  3. #3
    Registered User
    Join Date
    06-14-2022
    Location
    London
    MS-Off Ver
    2205
    Posts
    2

    Re: Nested IF statement with AND conditions

    Thank you so much.
    Been using Python for so long i forgot the difference haha

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,094

    Re: Nested IF statement with AND conditions

    Glad to help & thanks for the feedback.

  5. #5
    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,227

    Re: Nested IF statement with AND conditions

    Single quotes should be double quotes i.e " not '
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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 Statement with AND/OR conditions
    By lateniteNC1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-26-2020, 04:03 PM
  2. Nested If Statement with many conditions
    By jacobmarsh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2019, 10:07 AM
  3. Replies: 2
    Last Post: 07-09-2015, 04:25 PM
  4. Nested If Statement with Multiple Logical Conditions
    By gatefire08 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-18-2014, 12:17 PM
  5. [SOLVED] 3 conditions coming from one cell.. Nested If Statement??
    By trosasco in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-08-2013, 02:52 PM
  6. Replies: 11
    Last Post: 10-26-2011, 03:24 PM
  7. Nested IF statement 3 conditions 3 outcomes
    By Nick_in_Dubai in forum Excel General
    Replies: 1
    Last Post: 03-12-2009, 04:38 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