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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
electrobrit
Post Patron
Post Patron

in Power Query: If 2 columns contain specific text then this, else, this

Power Query: what is formula?
If Column A contains "arlene" and column B contains "arlene", then YES, otherwise, NO.

Column AColumn BCondition
John PetersArlene.Winters@e.comNO
Sherry De LeonKathy.Martin@E.comNO
jessica whithersKathy.Martin@E.comNO
Sandy Alan DomSandy.Dom@E.comNO
arlene w.Arlene.Winters@e.comYES
arlene w.Arlene.Winters@e.comYES
arlene w.Kathy.Martin@E.comNO
2 ACCEPTED SOLUTIONS
Zubair_Muhammad
Community Champion
Community Champion

Hi @electrobrit 

 

As a custom column

 

=Text.Contains([Column A],"arlene",Comparer.OrdinalIgnoreCase) 
and 
Text.Contains([Column B],"arlene",Comparer.OrdinalIgnoreCase)

View solution in original post


@electrobrit wrote:

The column results are "error"


What was the error?

 


@electrobrit wrote:

1. how do I add the Yes if true, no if not? I tried to add at end and it didn't work.

= if Text.Contains([Column A],"arlene",Comparer.OrdinalIgnoreCase) 
and
Text.Contains([Column B],"arlene",Comparer.OrdinalIgnoreCase) = true then "YES" else "NO"

@electrobrit wrote:

2. it would not take the "and" so I used "&" and it seemed to work when doing custom column (it said not syntax error have been detected) but is that correct for what I'm trying to do?


'and' worked for me, unsure why it did not work for you

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



View solution in original post

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

Hi @electrobrit 

 

As a custom column

 

=Text.Contains([Column A],"arlene",Comparer.OrdinalIgnoreCase) 
and 
Text.Contains([Column B],"arlene",Comparer.OrdinalIgnoreCase)

@Zubair_Muhammad thank you for your response! 
The column results are "error"
1. how do I add the Yes if true, no if not? I tried to add at end and it didn't work.

2. it would not take the "and" so I used "&" and it seemed to work when doing custom column (it said not syntax error have been detected) but is that correct for what I'm trying to do?


@electrobrit wrote:

The column results are "error"


What was the error?

 


@electrobrit wrote:

1. how do I add the Yes if true, no if not? I tried to add at end and it didn't work.

= if Text.Contains([Column A],"arlene",Comparer.OrdinalIgnoreCase) 
and
Text.Contains([Column B],"arlene",Comparer.OrdinalIgnoreCase) = true then "YES" else "NO"

@electrobrit wrote:

2. it would not take the "and" so I used "&" and it seemed to work when doing custom column (it said not syntax error have been detected) but is that correct for what I'm trying to do?


'and' worked for me, unsure why it did not work for you

 






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



@Chris Thanks, I didn't have the "if" in front.That worked perfectly.

Thank you for both @Zubair_Muhammad  and @ChrisMendoza   for the great help 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors