Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 57
Default Search a string in a cell for a list of 3 letter codes

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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.
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 24
Default Search a string in a cell for a list of 3 letter codes


try

=LOOKUP(,-FIND({"COU";"CUR";"DEC";"DEM"},A1),{"COUNTER CHANGE OUT";"CURB
REPLACEMENT";"DECK/PATIO";"DEMOLITION"})

Regards
Bosco

"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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Search a string in a cell for a list of 3 letter codes

On Thu, 6 Nov 2008 13:15:01 -0800, 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


Is there only going to be one code within the string?
Will the code ever be at the very beginning or end of the string?

How do you want to indicate that there is a code in the string?

NAME your code list, on Sheet2!A1:A60 or so: CodeList
NAME your code table, on Sheet2!A1:B60 or so: CodeTbl

If there will always be <space before and after the code, and if there will
only be one unique code in each imported string,

Then with your string in A1:

Use this **array-entered** formula to return the code:

=INDEX(CodeList,MATCH(TRUE,ISNUMBER(FIND(" "&CodeList&" ",A1)),0))

To **array-enter** a formula, hold down <ctrl<shift while hitting <enter
Excel will place braces {...} around the formula.

To decode the return, you can use this:

Assume the above formula is in B1, then:

=VLOOKUP(B1,CodeTbl,2,FALSE)





--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search for string of characters in a cell BRB Excel Discussion (Misc queries) 3 August 21st 08 07:44 PM
search if a string contains text matching items in a list neil Excel Worksheet Functions 3 March 11th 08 09:13 PM
Change 3 letter text string to a number string Pete Excel Discussion (Misc queries) 3 December 31st 07 07:47 PM
FIND / SEARCH text compare cell to string in 3rd cell nastech Excel Discussion (Misc queries) 0 October 29th 07 02:51 AM
Using Vlookup in a string search of a cell Ralph Heidecke Excel Worksheet Functions 1 April 26th 06 06:46 PM


All times are GMT +1. The time now is 04:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"