What am I doing wrong? Contains() does not work the way I expect it to

I’m sure I’m doing something wrong, but I can’t seem to figure out what. Can someone point me in the right direction? How can I trigger the checkbox to return “true” if the Keyword column in that row contains a certain string?

I have a checkbox column with a formula: thisRow.Keyword.Contains(“vs”) and the idea is to search the Keyword column of that row for the string “vs” and return true if the string is found.

I believe Contains() is meant to search through a list, so maybe the problem is that the Keyword column is a text value, not a list value? But if that’s the reason it’s not working, I don’t know what else to do.

Thank you in advance!

Hello @Shaina_Nacion

I think here that the use of this formula would be more appropriate:

(“If(condition, ifTrue, ifFalse)”), which would give in your case if(Keyword=true, true(), False()). I could be wrong, but considering the time 4 am, I’m not sure of anything without having access to a copy of the document. :slight_smile:

Sincerely,

Thierry

1 Like

Hi Shaina,

Contains searches an array for any matching items within it. What you’re looking for is ContainsText() , which searches a string for a matching substring and outputs true if the string contains matches.

I might also recommend using .lower() on the string before ContainsText() to force lowercase handling if you’re worried about capital letters interfering.

4 Likes

Ah that makes a lot of sense! I’ll give that a try. Thank you!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.