0

I'm trying to create formula field which returns 1 when text field CONTAINS certain text, else 0. E.g. if text field "City" CONTAINS NY or New York or NewYork, then it should return 1 else 0.

I'm able to achieve this using EQUALS as follows. But I want to use CONTAINS. Can someone please help, how to use CONTAINS or any other solution that searches particular text within a text field and returns NUMBER?

if (City= "NY" || City = "New York" || City = "NewYork", 1, 0) 

I tried this as well but it gives error "Incorrect number of parameters for function 'if()'. Expected 3, received 5".

if (CONTAINS(City,"NY"),CONTAINS(City,"New York"),CONTAINS(City,"NewYork"),1,0) 
0

You can have a combination of OR and IF like this.

if (OR(CONTAINS(City,"NY"),CONTAINS(City,"New York"),CONTAINS(City,"NewYork")),1,0) 

Here your IF logic will be calculated on OR basis and if you City has any one of the three text, it will result in true and return 1, orelse 0.

1
  • Thanks. Your solution worked Nagendra Singh.
    – NikM
    Jul 27 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.