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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Tfox2791

New Member
Joined
Nov 21, 2012
Messages
32
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?
 

bschwartz

Well-known Member
Joined
Jan 5, 2013
Messages
1,367
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.
 

bschwartz

Well-known Member
Joined
Jan 5, 2013
Messages
1,367
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,112
Messages
5,640,174
Members
417,130
Latest member
Darion2021

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
Top