Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 542
Default Extracting text from a cell

Hi all,

I have a list of categories to indicate employee disciplines, i.e
Management
Electrical
Mechanical
Other
and so on.

I have other cells within my spreadsheet that have text that includes the
categories above. For example,

Electrical Engineer
Senior Electrical Engineer
Junior Electrical Engineer

I would like to search these text strings using the categories above to
return only the category. Therefore, if i had A1 = Electrical Engineer, B1
needs to be a formula that gives the result of Electrical. If I then changed
A1 to Mechanical Engineer, B1 needs to automatically change to Mechanical.

Any suggestions

--
J
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Extracting text from a cell

Try this:

With your list of categories in the range J1:J4

Enter this formula in B1:

=LOOKUP(2,1/(ISNUMBER(SEARCH(J$1:J$4,A1))),J$1:J$4)

Copy down as needed.

Note that if a cell contains 2 or more categories: Other - Mechanical
Estimator, the formula will return the *last* category that matches. In this
case both Other and Mechanical are matches but Other appears in the category
list after Mechanical so the result of the formula is Other.


--
Biff
Microsoft Excel MVP


"James" wrote in message
...
Hi all,

I have a list of categories to indicate employee disciplines, i.e
Management
Electrical
Mechanical
Other
and so on.

I have other cells within my spreadsheet that have text that includes the
categories above. For example,

Electrical Engineer
Senior Electrical Engineer
Junior Electrical Engineer

I would like to search these text strings using the categories above to
return only the category. Therefore, if i had A1 = Electrical Engineer,
B1
needs to be a formula that gives the result of Electrical. If I then
changed
A1 to Mechanical Engineer, B1 needs to automatically change to Mechanical.

Any suggestions

--
J



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 542
Default Extracting text from a cell

Thanks, that works great.

If I had an employee that was entered as Mechanical Director, how would I go
about classifying this guy as Management?

Also if an employee was entered as Building Simulation, how would I go about
classifying as Sustainability?


On a separate issue, I posted a question "Dividing hours between working
weeks". Have you got any thoughts on how I might tackle that?

Thanking you in advance
--
J


"T. Valko" wrote:

Try this:

With your list of categories in the range J1:J4

Enter this formula in B1:

=LOOKUP(2,1/(ISNUMBER(SEARCH(J$1:J$4,A1))),J$1:J$4)

Copy down as needed.

Note that if a cell contains 2 or more categories: Other - Mechanical
Estimator, the formula will return the *last* category that matches. In this
case both Other and Mechanical are matches but Other appears in the category
list after Mechanical so the result of the formula is Other.


--
Biff
Microsoft Excel MVP


"James" wrote in message
...
Hi all,

I have a list of categories to indicate employee disciplines, i.e
Management
Electrical
Mechanical
Other
and so on.

I have other cells within my spreadsheet that have text that includes the
categories above. For example,

Electrical Engineer
Senior Electrical Engineer
Junior Electrical Engineer

I would like to search these text strings using the categories above to
return only the category. Therefore, if i had A1 = Electrical Engineer,
B1
needs to be a formula that gives the result of Electrical. If I then
changed
A1 to Mechanical Engineer, B1 needs to automatically change to Mechanical.

Any suggestions

--
J




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Extracting text from a cell

Ok, it could get a little tricky if you have lots of items that contain a
related "keyword" for another category. For example, Mechanical Director =
Management and Mechanical Engineer = Mechanical.

See this screencap:

http://img81.imageshack.us/img81/3900/lookupex9.jpg

You need to create a 2 column table. Notice in the table how I've listed
Mechanical and Mechanical Director. Mechanical director is listed *after*
Mechanical.

Or, for the entry Mechanical Director you could use Director as the keyword.
Then in the lookup table you would replace Mechanical Director = Management
with Director = Management.

--
Biff
Microsoft Excel MVP


"James" wrote in message
...
Thanks, that works great.

If I had an employee that was entered as Mechanical Director, how would I
go
about classifying this guy as Management?

Also if an employee was entered as Building Simulation, how would I go
about
classifying as Sustainability?


On a separate issue, I posted a question "Dividing hours between working
weeks". Have you got any thoughts on how I might tackle that?

Thanking you in advance
--
J


"T. Valko" wrote:

Try this:

With your list of categories in the range J1:J4

Enter this formula in B1:

=LOOKUP(2,1/(ISNUMBER(SEARCH(J$1:J$4,A1))),J$1:J$4)

Copy down as needed.

Note that if a cell contains 2 or more categories: Other - Mechanical
Estimator, the formula will return the *last* category that matches. In
this
case both Other and Mechanical are matches but Other appears in the
category
list after Mechanical so the result of the formula is Other.


--
Biff
Microsoft Excel MVP


"James" wrote in message
...
Hi all,

I have a list of categories to indicate employee disciplines, i.e
Management
Electrical
Mechanical
Other
and so on.

I have other cells within my spreadsheet that have text that includes
the
categories above. For example,

Electrical Engineer
Senior Electrical Engineer
Junior Electrical Engineer

I would like to search these text strings using the categories above to
return only the category. Therefore, if i had A1 = Electrical
Engineer,
B1
needs to be a formula that gives the result of Electrical. If I then
changed
A1 to Mechanical Engineer, B1 needs to automatically change to
Mechanical.

Any suggestions

--
J






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
Extracting text from a cell kfowlow Excel Discussion (Misc queries) 2 November 17th 06 06:58 PM
EXTRACTING NUMBERS FROM A TEXT CELL SSJ New Users to Excel 11 October 11th 06 07:20 PM
Extracting part of Text from one cell to another JayW Excel Worksheet Functions 12 August 21st 06 12:47 PM
Extracting text from a cell entry morchard Excel Discussion (Misc queries) 2 July 6th 05 03:53 PM
extracting text data in a cell gareth1983 Excel Worksheet Functions 2 June 6th 05 02:08 AM


All times are GMT +1. The time now is 01:58 PM.

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

About Us

"It's about Microsoft Excel"