Partial Text Lookup

tycasey17

Board Regular
Joined
Sep 26, 2013
Messages
93
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I am trying to figure out how to detect if a code has a letter in it no matter where in the string of text.

I have a formula giving out codes like this "DR", "RD", "CD", "CR-M", etc. in A1. I am trying to get either "Y" or "N" in A2 if one of the codes contains an "R" in the code. I tried using the LOOKUP function but can't seem to work it right or maybe it's not the best formula to use.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
If you are only looking for upper case "R", then try this formula:
Excel Formula:
=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"R",""))>0,"Y","N")

If you also want to include lower case "r", use this instead:
Excel Formula:
=IF(LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),"R",""))>0,"Y","N")
 
Upvote 0
Solution
Alternative solution. Replace FIND with SEARCH if you need it to be case-insensitive.

Excel Formula:
=IF(ISNUMBER(FIND("R",A1)),"Y","N")
 
Upvote 0
All the solutions worked nicely for what I was trying to accomplish, thank you for your assistance.
 
Upvote 0

Forum statistics

Threads
1,215,254
Messages
6,123,894
Members
449,132
Latest member
Rosie14

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