none
Test for several conditions with several result outputs: more than "If"

    Question

  • Hi Everyone

    I would like to test for several conditions in a column and for each one have a different hard-coded output value. I can use an "If" statement for two output values (true and false), but is there a function that allows for more than two?

    I tried the below with 'Switch' and it is generating an error due to the 'and':

    =SWITCH(True(),[SchBegDiffNumber]>0 and [SchBegDiffNumber]<=5,5)

    Is there another method that can evaluate values in a column and within the evaluation test for a high and a low value?


    Paul



    • Edited by Paul-NYS Thursday, August 14, 2014 7:52 PM
    Thursday, August 14, 2014 7:07 PM

Answers

  • I just solved my own problem. The below will work:

    =SWITCH(True(),[SchBegDiffNumber]>0 && [SchBegDiffNumber]<=5,5)

    Paul

    • Marked as answer by Paul-NYS Thursday, August 14, 2014 8:20 PM
    Thursday, August 14, 2014 8:05 PM

All replies

  • Switch is certainly a viable function for testing multiple conditions. Could you provide an example of what you'll be doing, or some sample data?
    Thursday, August 14, 2014 7:49 PM
  • I just added an example above. I would like to test for a value that is above and below certain numbers and do this for multiple values in the column.

    Paul

    Thursday, August 14, 2014 7:53 PM
  • I just solved my own problem. The below will work:

    =SWITCH(True(),[SchBegDiffNumber]>0 && [SchBegDiffNumber]<=5,5)

    Paul

    • Marked as answer by Paul-NYS Thursday, August 14, 2014 8:20 PM
    Thursday, August 14, 2014 8:05 PM