Consulting

Results 1 to 8 of 8

Thread: What is wrong with this If statement?

  1. #1

    What is wrong with this If statement?

    =IF(S2="NO" AND T2="","must write something",IF(S2="YES" AND T2 <>"", "Must be blank",""))

  2. #2
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location
    =if(evaluation, True, false)

    =if(and(s2="NO", T2=""), "must write something", "Must be blank")

    you cannot do compound if statements in a cell
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  3. #3
    [VBA]
    =if(and(S2="no", T2=""),"Must Write Something",if(and(S2="yes", T2<>""),"Must be blank",""))
    [/VBA]
    Phil J.

  4. #4
    Quote Originally Posted by ProteanBeing
    =if(evaluation, True, false)

    =if(and(s2="NO", T2=""), "must write something", "Must be blank")

    you cannot do compound if statements in a cell
    Sorry but unless I'm missunderstanding I don't believe that's true. You can have as many nested ifs as you like in a single cell
    Phil J.

  5. #5
    VBAX Tutor
    Joined
    Oct 2007
    Posts
    210
    Location
    I guess you can compound if's (sorry). The and statement should have worked though
    "The amount of stupid people in the world is God's way of punishing the smart people" - protean_being

  6. #6
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,443
    Location
    Quote Originally Posted by PhilJette
    Sorry but unless I'm missunderstanding I don't believe that's true. You can have as many nested ifs as you like in a single cell
    Sorry, but that is not true.

    Prior to Excel 2007, you can only have 7 nested functions, including IF.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  7. #7
    ah touch?
    Sorry about that, thanks for the clarification
    Phil J.

  8. #8
    VBAX Expert
    Joined
    Aug 2007
    Location
    Windermere, FL, a 'burb in the greater Orlando metro area.
    Posts
    567
    Location
    Quote Originally Posted by PhilJette
    Sorry but unless I'm missunderstanding I don't believe that's true. You can have as many nested ifs as you like in a single cell
    Phil, almost correct, I believe the limit is 7 nested if statements in a cell.

    Ron

    (hmm? I see my answer was good only prior to 2007) ;-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •