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

Hi

I am trying to extract part of a cell's content, I understand how MID
LEFT etc. work but as far as I know they are all based on counting the
number of characters from a certain position within a cell.

What I am looking for is extracting the content of a cell upto a
specific character type e,g

Cell A2 = "HP DL380 G1-2-685"

I want to extract "HP DL380 G1" from the cell, in otherwords, upto the
the 1st hyphen.

The reason I cannot count the characters is that the data set has
mulitple hardware types of various character lenghts.

Is this possible, and if so how?


Many thanks
Andy
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Extracting part of a cell

Think I may have somthing, if anyone has anything better please let me
know.

Thanks

OK I use:

=SEARCH("-",A2,1) to find the position of the 1st hyphen in cell A2

I then use:

=MID(F22,1,(BE22-1)) to extract the text upto the 1st hyphen, the -1
is to remove it.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Extracting part of a cell

Try,

=TRIM(LEFT(A2,FIND("-",A2,1)-1))

Mike

" wrote:

Hi

I am trying to extract part of a cell's content, I understand how MID
LEFT etc. work but as far as I know they are all based on counting the
number of characters from a certain position within a cell.

What I am looking for is extracting the content of a cell upto a
specific character type e,g

Cell A2 = "HP DL380 G1-2-685"

I want to extract "HP DL380 G1" from the cell, in otherwords, upto the
the 1st hyphen.

The reason I cannot count the characters is that the data set has
mulitple hardware types of various character lenghts.

Is this possible, and if so how?


Many thanks
Andy

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Extracting part of a cell

=LEFT(A1,FIND("-",A1)-1)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

wrote in message
...
Hi

I am trying to extract part of a cell's content, I understand how MID
LEFT etc. work but as far as I know they are all based on counting the
number of characters from a certain position within a cell.

What I am looking for is extracting the content of a cell upto a
specific character type e,g

Cell A2 = "HP DL380 G1-2-685"

I want to extract "HP DL380 G1" from the cell, in otherwords, upto the
the 1st hyphen.

The reason I cannot count the characters is that the data set has
mulitple hardware types of various character lenghts.

Is this possible, and if so how?


Many thanks
Andy



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Extracting part of a cell

Hi,

Assuming the formula
=SEARCH("-",A2,1)

is in BE22 then your formula
=MID(F22,1,(BE22-1)) will work but because you want the leftmost part it
would be better to use LEFT rather than MID and there is no need to put the
search formula in a seperate cell. I would also suggest you include the TRIM
option in my previous post to take care of any spaces at the start-end of the
extracted string.

Mike

" wrote:

Think I may have somthing, if anyone has anything better please let me
know.

Thanks

OK I use:

=SEARCH("-",A2,1) to find the position of the 1st hyphen in cell A2

I then use:

=MID(F22,1,(BE22-1)) to extract the text upto the 1st hyphen, the -1
is to remove it.




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Extracting part of a cell

Thanks all - I never knew about TRIM, I love this place :) :)

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 part of Text from one cell to another JayW Excel Worksheet Functions 12 August 21st 06 12:47 PM
Extracting Part of a Date GLT Excel Discussion (Misc queries) 2 November 23rd 05 12:04 AM
extracting comments in a cell and making these part of the Chart . Charles Charts and Charting in Excel 2 April 19th 05 03:40 PM
Formula for Extracting Alphabetic Part of a Product Code ob3ron02 Excel Worksheet Functions 1 October 29th 04 07:05 PM
Formula for Extracting Alphabetic Part of a Product Code ob3ron02 Excel Worksheet Functions 1 October 29th 04 06:07 PM


All times are GMT +1. The time now is 07:17 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"