Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default Lookup text in a string with wildcard and return a certain value

I am using Excel 2003. I can't seem to figure out a function. I need help
on looking for a certain value in a long string and return a certain value in
the column before the string value. Here is the formula I've been using.

For example, here is row 5 and their values:

C5 D5
(blank) 2007SW210123456
C6 D6
(blank) 2006SW010123456

If I am looking for text in D5 that have a value of SW21, if so, return CMO
in C5.
If I am looking for text in D5 that have a value of SW01, then return ABQ in
C6.

The formula I've been using in column C cells is:
=LOOKUP(D5:D5000,{*SW01*,*SW03*,*SW05*,*SW07*,*SW0 9*,*SW11*,*SW13*,*SW15*,*SW17*,*SW19*,*SW21*,*SW27 *,*SW29*},{"ABQ","BTR","DAL","DFW","HOU","LIT","LB B","OKC","SAT","CMO","COA","SWA"})

Am I doing something wrong?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,696
Default Lookup text in a string with wildcard and return a certain value

Should the first value be merely D5 rather than D5:5000? Then as you copy
down the column, it auto-increases..

"Tommy" wrote:

I am using Excel 2003. I can't seem to figure out a function. I need help
on looking for a certain value in a long string and return a certain value in
the column before the string value. Here is the formula I've been using.

For example, here is row 5 and their values:

C5 D5
(blank) 2007SW210123456
C6 D6
(blank) 2006SW010123456

If I am looking for text in D5 that have a value of SW21, if so, return CMO
in C5.
If I am looking for text in D5 that have a value of SW01, then return ABQ in
C6.

The formula I've been using in column C cells is:
=LOOKUP(D5:D5000,{*SW01*,*SW03*,*SW05*,*SW07*,*SW0 9*,*SW11*,*SW13*,*SW15*,*SW17*,*SW19*,*SW21*,*SW27 *,*SW29*},{"ABQ","BTR","DAL","DFW","HOU","LIT","LB B","OKC","SAT","CMO","COA","SWA"})

Am I doing something wrong?

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Lookup text in a string with wildcard and return a certain value

Create a 2 column table like this:

SW01...ABQ
SW03...BTR
SW05...DAL
SW07...DFW

Assume that table is in the range F2:G5

Enter this formula C5:

=LOOKUP(2,1/SEARCH(F$2:F$5,D5),G$2:G$5)

Copy down as needed

--
Biff
Microsoft Excel MVP


"Tommy" wrote in message
...
I am using Excel 2003. I can't seem to figure out a function. I need help
on looking for a certain value in a long string and return a certain value
in
the column before the string value. Here is the formula I've been using.

For example, here is row 5 and their values:

C5 D5
(blank) 2007SW210123456
C6 D6
(blank) 2006SW010123456

If I am looking for text in D5 that have a value of SW21, if so, return
CMO
in C5.
If I am looking for text in D5 that have a value of SW01, then return ABQ
in
C6.

The formula I've been using in column C cells is:
=LOOKUP(D5:D5000,{*SW01*,*SW03*,*SW05*,*SW07*,*SW0 9*,*SW11*,*SW13*,*SW15*,*SW17*,*SW19*,*SW21*,*SW27 *,*SW29*},{"ABQ","BTR","DAL","DFW","HOU","LIT","LB B","OKC","SAT","CMO","COA","SWA"})

Am I doing something wrong?

Thank you



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default Lookup text in a string with wildcard and return a certain val

That worked! Thanks Biff!!! You're a Genius!

Tommy

"T. Valko" wrote:

Create a 2 column table like this:

SW01...ABQ
SW03...BTR
SW05...DAL
SW07...DFW

Assume that table is in the range F2:G5

Enter this formula C5:

=LOOKUP(2,1/SEARCH(F$2:F$5,D5),G$2:G$5)

Copy down as needed

--
Biff
Microsoft Excel MVP


"Tommy" wrote in message
...
I am using Excel 2003. I can't seem to figure out a function. I need help
on looking for a certain value in a long string and return a certain value
in
the column before the string value. Here is the formula I've been using.

For example, here is row 5 and their values:

C5 D5
(blank) 2007SW210123456
C6 D6
(blank) 2006SW010123456

If I am looking for text in D5 that have a value of SW21, if so, return
CMO
in C5.
If I am looking for text in D5 that have a value of SW01, then return ABQ
in
C6.

The formula I've been using in column C cells is:
=LOOKUP(D5:D5000,{*SW01*,*SW03*,*SW05*,*SW07*,*SW0 9*,*SW11*,*SW13*,*SW15*,*SW17*,*SW19*,*SW21*,*SW27 *,*SW29*},{"ABQ","BTR","DAL","DFW","HOU","LIT","LB B","OKC","SAT","CMO","COA","SWA"})

Am I doing something wrong?

Thank you




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Lookup text in a string with wildcard and return a certain val

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"Tommy" wrote in message
...
That worked! Thanks Biff!!! You're a Genius!

Tommy

"T. Valko" wrote:

Create a 2 column table like this:

SW01...ABQ
SW03...BTR
SW05...DAL
SW07...DFW

Assume that table is in the range F2:G5

Enter this formula C5:

=LOOKUP(2,1/SEARCH(F$2:F$5,D5),G$2:G$5)

Copy down as needed

--
Biff
Microsoft Excel MVP


"Tommy" wrote in message
...
I am using Excel 2003. I can't seem to figure out a function. I need
help
on looking for a certain value in a long string and return a certain
value
in
the column before the string value. Here is the formula I've been
using.

For example, here is row 5 and their values:

C5 D5
(blank) 2007SW210123456
C6 D6
(blank) 2006SW010123456

If I am looking for text in D5 that have a value of SW21, if so, return
CMO
in C5.
If I am looking for text in D5 that have a value of SW01, then return
ABQ
in
C6.

The formula I've been using in column C cells is:
=LOOKUP(D5:D5000,{*SW01*,*SW03*,*SW05*,*SW07*,*SW0 9*,*SW11*,*SW13*,*SW15*,*SW17*,*SW19*,*SW21*,*SW27 *,*SW29*},{"ABQ","BTR","DAL","DFW","HOU","LIT","LB B","OKC","SAT","CMO","COA","SWA"})

Am I doing something wrong?

Thank you






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
return a character at a certain position in a string of text Miranda Excel Worksheet Functions 3 May 8th 23 11:46 AM
Formula to return part of a text string luvthavodka Excel Discussion (Misc queries) 9 October 20th 08 05:27 PM
Search, find or lookup defined text in text string zzxxcc Excel Worksheet Functions 9 September 6th 07 09:37 PM
Find $ in a string of text and return numbers Craig Excel Discussion (Misc queries) 5 September 13th 06 10:42 PM
Return a formula as text string to a cell Sharon Excel Worksheet Functions 4 April 18th 06 05:40 PM


All times are GMT +1. The time now is 06:28 AM.

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"