function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric WilligEric Willig 

Can I create a custom formula field that searches for text contained in another text field (not a picklist)?

Can I create a custom formula field that searches for text contained in another text field (not a picklist)?  We have a custom text field in our acount records that contains a long string of text (list of products that are updated in batch each night).  

I would like to create a sperate field that indicates if the first text field has 1 of 6 different words in it (they are specific products).

I can do this easily in excel but cannot figure out how to do it here.  The Contains argument is only for a picklist, yes?    Thanks, in advance, for you input.
Best Answer chosen by Eric Willig
Dario BakDario Bak
This is a formula field that will tell you what you want...
 
IF(
  OR(
    CONTAINS(name,'word1'),
    CONTAINS(name,'word2'),
    CONTAINS(name,'word3'),
    CONTAINS(name,'word4'),
    CONTAINS(name,'word5'),
    CONTAINS(name,'word6')
  ),
  'yes it does',
  'no it doesnt'
)

if it works, please mark as best response!

May the force.com be with you

All Answers

Dario BakDario Bak
This is a formula field that will tell you what you want...
 
IF(
  OR(
    CONTAINS(name,'word1'),
    CONTAINS(name,'word2'),
    CONTAINS(name,'word3'),
    CONTAINS(name,'word4'),
    CONTAINS(name,'word5'),
    CONTAINS(name,'word6')
  ),
  'yes it does',
  'no it doesnt'
)

if it works, please mark as best response!

May the force.com be with you
This was selected as the best answer
Eric WilligEric Willig
This worked flawlessly, thank you Dario!