Using IF, FUNCTIONS (HAS, CONTAINS, etc.), and OR (for searched fields).

Michael W.
Michael W. ✭✭✭✭
edited 05/12/21 in Formulas and Functions

Greetings Team,


I feel like I'm missing something simple on this one, but it's a general problem that I encounter a lot.


For this question, I'm able to construct formulas that Smartsheet accepts, but the current version is long and more difficult to understand/manage from other users. This involves using IF, FUNCTIONS, and OR (for the different searched fields). I'm looking for a more elegant/simple solution.


Current Setup

Currently, the in-scope formulas are structured like this

=IF(OR(CONTAINS((search_for #1), (field range / reference #1)),

CONTAINS((search_for #2), (field range / reference #1)),

CONTAINS((search_for #3), (field range / reference #1))),

value_if_true, value_if_false)


Seen above, I'm using the same function (CONTAINS) and the same reference (#1) multiple times. It's wasteful and generates a lot of fluff, especially when you have multiple nested IF functions and a dozen search criteria.

Goal: It would be more efficient in this example, to have one function (Contains), one reference, and multiple search_for values, if possible.


Example Setup that doesn't work... (But if it did, it would solve my need)

=IF(CONTAINS(OR(search_for #1), (search_for #2), (search_for #3)), (field range / reference #1)),

value_if_true, value_if_false)


How can we make this^ work?


Thank you for your attention.

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!