Nest If/Or with Contains
So with multiple drop downs I want the HC Froup to result in either one of three returns: backfill, backfill repuposed, or new. I am getting an uparseble error. Following is a snapshot of the attempt
Best Answers
-
Hello @Catherine Shea
The syntax in the CONTAINS functions was in error and caused the unparseable. The next opportunity with the formula was the order of the IFs. An IF formula will advance until the first true statement is found, then the formula stops. Since the CONTAINS function will find any instance of a word, in your original formula the CONTANS with only the word "Backfill" would find your desired cells with the word Backfill as well as in the cells with the words "Backfill Repurposed". To mitigate this, I swapped the order of the IF statements so that the formula stops if Repurposed is found. In the snippet you showed it didn't look like it was necessary to write out the entire "Backfill Repurposed" so lazily I didn't- you can add "backfill repurposed' to the formula if desired.
=IF(CONTAINS("New", [HC Group]@row), "New", IF(CONTAINS("Repurpose", [HC Group]@row), "Backfill Repurposed", IF(CONTAINS("Backfill", [HC Group]@row), "Backfill")))
Will this work for you?
Kelly
-
Thanks Kelly for taking the time for the explanation and the fix on this. I used the exmaple you provided and it indeed was the solution. ☺️
Answers
-
Hello @Catherine Shea
The syntax in the CONTAINS functions was in error and caused the unparseable. The next opportunity with the formula was the order of the IFs. An IF formula will advance until the first true statement is found, then the formula stops. Since the CONTAINS function will find any instance of a word, in your original formula the CONTANS with only the word "Backfill" would find your desired cells with the word Backfill as well as in the cells with the words "Backfill Repurposed". To mitigate this, I swapped the order of the IF statements so that the formula stops if Repurposed is found. In the snippet you showed it didn't look like it was necessary to write out the entire "Backfill Repurposed" so lazily I didn't- you can add "backfill repurposed' to the formula if desired.
=IF(CONTAINS("New", [HC Group]@row), "New", IF(CONTAINS("Repurpose", [HC Group]@row), "Backfill Repurposed", IF(CONTAINS("Backfill", [HC Group]@row), "Backfill")))
Will this work for you?
Kelly
-
Thanks Kelly for taking the time for the explanation and the fix on this. I used the exmaple you provided and it indeed was the solution. ☺️
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- 10.6K Get Help
- 63 Global Discussions
- 68 Industry Talk
- 385 Announcements
- 3.5K Ideas & Feature Requests
- 55 Brandfolder
- 125 Just for fun
- 50 Community Job Board
- 464 Show & Tell
- 40 Member Spotlight
- 44 Power Your Process
- 28 Sponsor X
- 234 Events
- 7.3K Forum Archives
Check out the Formula Handbook template!