Discussions

Expand all | Collapse all

Can a formula field IF check if a value is in a list of values?

  • 1.  Can a formula field IF check if a value is in a list of values?

    Posted 02-15-2019 22:47
    I have a formula field where I'd like to check if the value in a field is contained in a list of values
    IF([Field1] in [1, 2, 5, 10], "Yes", "No")  
    Is this possible somehow?_  If the value in Field1 is one of the values in my list (1, 2, 5, 10), then output "Yes", otherwise output "No"

    Or do I need to put each line separately?
    If([Field1] = 1, "Yes",     [Field1] = 2, "Yes",     [Field1] = 5, "Yes",     [Field1] = 10, "Yes",     "No")  


  • 2.  RE: Can a formula field IF check if a value is in a list of values?

    Posted 02-15-2019 23:00
    You are safer with the IF and listing all the values lie you did in our example.  The "Contains" function is really for text values and you will get messed up between for example, 1 and 10 where they both contain a 1.

    With numeric values you should use the formula you suggested where the conditions are listed vertically.