identify a cell that contains spedific text

Lenna

Active Member
Joined
Jun 25, 2014
Messages
269
I need to identify cells in row Q that contain words "Donor"/"donor" or "Transplant"/"transplant" either in the beginning or in the middle of a sentence. The following line of code looks for an exact match. If there are other words in a cell it doesn't find it. Please alter this line so it allows for other text to be present in a cell

Thank you


Cells(x, 17).Value = "Donor" or Cells(x, 17).Value = "Transplant"</pre>
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
C2 = Tim buck two Donor
C3 = Tommy needs a Transplant

=OR(ISNUMBER(FIND("Donor",C2)),ISNUMBER(FIND("Transplant",C2)))
=OR(ISNUMBER(FIND("Donor",C3)),ISNUMBER(FIND("Transplant",C3)))


Result of formula = True for both
Does this help?
 
Upvote 0
C2 = Tim buck two Donor
C3 = Tommy needs a Transplant

=OR(ISNUMBER(FIND("Donor",C2)),ISNUMBER(FIND("Transplant",C2)))
=OR(ISNUMBER(FIND("Donor",C3)),ISNUMBER(FIND("Transplant",C3)))


Result of formula = True for both
Does this help?

You need to use SEARCH for non-case sensitive.
 
Upvote 0
This is a formula, not VBA code. I was adding on to the post from Tfox2791 above:

=OR(ISNUMBER(SEARCH({"donor","transplant"},C2)))

Assuming you have text values in column C starting at row 2... Otherwise change C2 to the cell reference where the text is located, and copy down.
 
Upvote 0

Forum statistics

Threads
1,217,317
Messages
6,135,847
Members
449,965
Latest member
Ckl43

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