Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

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

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

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", "" )
    )
)

View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

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
Not applicable

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

Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks for your help Ashish. 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.