Find if any of the cells in a row contain a text string.

artins

New Member
Joined
Aug 8, 2011
Messages
5
Hi, I have a simple question (or at least it seams but I can't get it working).

I need to see if the cells from B2:BM2 contain the word "WARNING" and if yes return "WARNING" in A2 if not blank.

Please help
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi, I have a simple question (or at least it seams but I can't get it working).

I need to see if the cells from B2:BM2 contain the word "WARNING" and if yes return "WARNING" in A2 if not blank.

Please help
Assuming you mean that if ANY cell contains WARNING then return the same.

One way...

=IF(COUNTIF(B2:BM2,"warning"),"WARNING","")
 
Upvote 0
Hi, I have a simple question (or at least it seams but I can't get it working).

I need to see if the cells from B2:BM2 contain the word "WARNING" and if yes return "WARNING" in A2 if not blank.

Please help

Try...

IF(COUNTIF(B2:BM2,"*WARNING*"),"WARNING","")
 
Upvote 0
Thank you so much. It worked!
Did you mean the cells might also contain other text including the word warning?

Like this:

B2 = 1st Warning

Or, did you mean the cells will contain only the word warning (if any do)?

Like this:

B2 = Warning
 
Upvote 0
For this project was the word "Warning" in capital letters only.

But for the sake of expanding my excel knowledge :) How would you rewrite this formula for all cases (not case sensitive) + cells including the string.

Thanks
 
Upvote 0
For this project was the word "Warning" in capital letters only.

But for the sake of expanding my excel knowledge :) How would you rewrite this formula for all cases (not case sensitive) + cells including the string.

Thanks
Neither of the formulas suggested are case sensitive.

The reason I asked for clarification is the other poster used a different criteria and I just wanted to verify my understanding of what was asked.

If you want something that is case sensitive...

=IF(SUMPRODUCT(--(EXACT(B2:BM2,"WARNING"))),"WARNING","")

If at least one entry in the range matches the word WARNING exactly then the formula returns the same.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top