+ Reply to Thread
Results 1 to 7 of 7

Trouble with nested if/and statements

Hybrid View

NamiSama Trouble with nested if/and... 05-16-2014, 03:43 PM
ranman256 Re: Trouble with nested... 05-16-2014, 03:50 PM
NamiSama Re: Trouble with nested... 05-16-2014, 04:44 PM
Sam Capricci Re: Trouble with nested... 05-16-2014, 04:53 PM
NamiSama Re: Trouble with nested... 05-16-2014, 05:08 PM
FDibbins Re: Trouble with nested... 05-16-2014, 05:10 PM
NamiSama Re: Trouble with nested... 05-21-2014, 11:28 AM
  1. #1
    Registered User
    Join Date
    02-28-2014
    Location
    Aurora, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    37

    Trouble with nested if/and statements

    Hello! Hopefully my problem has an easy solution. I have an If statement that tests for multiple conditions, and it either always returns true, or alwasy returns false. I think this is because I'm not listing my conditions in the right order.

    The setup: I have 3 columns involved in the formula, and a box on another sheet controlled by a checkbox.
    The columns are Cert?, Cert #, and Price. The check box is for whether or not a cert is needed (since not everything has a cert #).

    The formula goes in the Cert? column

    My conditions:
    If the Price column (Z3) is blank, then blank
    If the Price column is not blank, then test the checkbox ("Sheet2"$B$3):
    If the checkbox is FALSE, then "Ok" (because I will use all selections if a cert is not needed)
    If the checkbox is TRUE, then test the Cert # column (W3)
    If the Cert # column is blank, then blank
    If the Cert # column has a number, then "Ok" (because if a cert is needed, I am only interested in the selections that have a cert #).

    I have tried the following formulas with no luck:

    =IF(Z3="","",IF('Sheet2'!$B$3=FALSE,"Ok",IF(W3>0,"ok",FALSE)))

    =IF(Z3="","",IF(AND('Sheet2'!$B$3="Ok",W3>0),"Ok",IF('Sheet2'!$B$3=FALSE,"Ok",FALSE)))

    Any help would be very much appreciated!
    Last edited by NamiSama; 05-16-2014 at 03:47 PM.

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,189

    Re: Trouble with nested if/and statements

    I think you were off 1 column (that last true in 1st line is a nother condition)

    =IF(Z3="","",IF('Sheet2'!$B$3=FALSE,IF(W3="","",IF(W3>0,TRUE,FALSE))))

  3. #3
    Registered User
    Join Date
    02-28-2014
    Location
    Aurora, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Trouble with nested if/and statements

    I tried this code, but it always comes back FALSE. I need it to be TRUE if 'Sheet2'!$B$3=TRUE & W3>0.

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Trouble with nested if/and statements

    have you tried putting FALSE in quotes "FALSE"?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  5. #5
    Registered User
    Join Date
    02-28-2014
    Location
    Aurora, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Trouble with nested if/and statements

    I just tried adding to quotes to both occurences of "false" in my formula, both seperately and together. I'm still getting a "false" where I should be getting a true.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,047

    Re: Trouble with nested if/and statements

    Just fyi, TRUE and FALSE are recognised terms in excel, and can be used without ""
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Registered User
    Join Date
    02-28-2014
    Location
    Aurora, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Trouble with nested if/and statements

    A few more days of tinkering and I got the code working. I needed a different way to test if a cell was blank (since it is blank, but not empty) I switched >0 for <>"" and now it works! Here is the working code:

    =IF(Z3="","",IF(AND('Sheet2'!$B$3=FALSE,Z3>0),TRUE,IF(AND('Sheet2'!$B$3=TRUE,Z3>0,W3<>""),TRUE,FALSE)))

+ 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. questions with if statements and nested if statements
    By Pat Excel in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-03-2013, 01:41 PM
  2. [SOLVED] Having trouble doing what I want with IF statements.
    By poisontoast in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-21-2012, 03:38 AM
  3. Multiple nested IF statements and AND statements
    By TonyGetz in forum Excel General
    Replies: 2
    Last Post: 12-14-2010, 03:07 AM
  4. Nested If statements / logic statements
    By Brainless_09 in forum Excel General
    Replies: 3
    Last Post: 06-17-2009, 02:59 PM
  5. Replies: 12
    Last Post: 05-15-2009, 08: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