Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

IF CONTAINS Formula

Greetings Everyone. 

I am trying to create a formula in a new calculated column

Basically what I am trying to do is: 

 

IF (text.in.row contains "ABC", "ABC") OR (text.in.row contains "EFG", "EFG") OR (text.in.row contains "XYZ", "XYZ") 

 

I did stumble upon this formula: 

CustomColumn = IF(
	ISERROR(
		SEARCH("A", TableName[ColumnName])
	),
	"A",
	"B"
)

Which did work for the first argument, but, the only issue is, it's not letting me do multiple IFs or multiple scenarios. 

 

Appreciate any help I can get. Doesn't have to be this particular formula, any formula to get me there would help

  • Something like this should work for you.

     

    Column =
    IF ( CONTAINSSTRING ( Table[Column], "ABC" ),"ABC",
        IF ( CONTAINSSTRING ( Table[Column], "EFG" ),"EFG",
            IF ( CONTAINSSTRING ( Table[Column], "XYZ" ), "XYZ", "" )
        )
    )

4 Replies

  • Something like this should work for you.

     

    Column =
    IF ( CONTAINSSTRING ( Table[Column], "ABC" ),"ABC",
        IF ( CONTAINSSTRING ( Table[Column], "EFG" ),"EFG",
            IF ( CONTAINSSTRING ( Table[Column], "XYZ" ), "XYZ", "" )
        )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      You ... my friend ... are a life saver !!! It worked perfectly. 

  • Hi,

    It will be ideal to create a Table with 2 columns - one listing all your search keywords and another listing all results you want to see when those search keywords are found in your Text column.  Please share your source data (could be dummy data) and this 2 column Table.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your help Ashish.