View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Glenn Glenn is offline
external usenet poster
 
Posts: 1,240
Default Search a string in a cell for a list of 3 letter codes

SteveT wrote:
I have a list of 3 letter codes (about 60 of them) that don't change. I
also have a bunch of strings exported from an application that contain one of
the 3 letter codes. All three letter codes are Caps and the exact location
of the code changes within each string. I was wondering if there was an easy
way to find out which code is in the string.

For example I have the list of codes in Sheet 2...
A B
COU COUNTER CHANGE OUT
CUR CURB REPLACEMENT
DEC DECK/PATIO
DEM DEMOLITION


And one of my strings in sheet 1 looks like...
A
13268 05/05/2008 5841 S LAGRANGEI OWNER: KEN HOOK 5 E AYERS HINSDALE,IL
60521 DEM *** 9,500.00 M & R DEMOLITION, INC. DEM B-3 400.00

Thanks in advance for any help
Steve



Maybe this will help. With your sting in A1 and COU, CUR, DEC & DEM in A2:A5,
put the following in B2 and copy down to B5:

=(LEN($A$1)-LEN(SUBSTITUTE($A$1," "&A2&" ","")))/(LEN(A2)+2)

....will tell you that "DEM" was found twice in your string, not counting the
occurrence in "DEMOLITION", which I assume you don't want counted.