Active Now

Malizz
Discussion » Statements » Rosie's Corner » If the "IF" is untrue the "THEN" will be too. How do you make sure it isn't?

If the "IF" is untrue the "THEN" will be too. How do you make sure it isn't?

Posted - December 5, 2019

Responses


  • 6023
    In computer formulas, the IF statement has two results:
    IF condition = {true} then action1 ... IF condition = {false} then action2.

    THEN depends on whether or not the IF condition is true or not ... so there are always at least 2 choices for outcomes.

    That's the whole point of any IF statement, as far as I know.
      December 5, 2019 8:10 AM MST
    2

  • 113301
    But how do you INSURE the "IF" is true Walt? How can a computer determine that?  Thank you for your reply! :)
      December 5, 2019 8:13 AM MST
    0

  • 6023
    It's simple for a computer.
    For a spreadsheet, you can say IF (cellX) = (valueY) then {actionA} else {actionB}

    In that instance, if the value in the cell is Y, the computer will perform {actionA}.
    If there is any other value other than Y, the statement is false and the computer will perform {actionB}

    I use such formulas all the time.  It's the easiest way to automate portions of spreadsheets.
    One is for 401(a) matching ... If the employee contribution is <= 3%, then the employer matches the employee contribution.  Otherwise (if the employee contribution is greater than 3%), the employer contributes 3%.
      December 5, 2019 8:30 AM MST
    0

  • 10449
    Not necessarily.  "If's" are like a fork in the road.  The paths are neither true or untrue.  They are simply paths.  Suppose I choose path A and it led me over a cliff.  My choice didn't cause path A to be the wrong choice.  Whether or not I took path A, it would still have led over a cliff. 

    Example - 

    If  2+3=5, then...


    A - 2+2=5
    B - 3+2=5

    No matter which answer I choose, answer A will always be wrong and answer B will always be right.  My choice, whether right or wrong, has no bearing on that.   
      December 5, 2019 12:10 PM MST
    0