Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Extract text from large Text

I have large text like this: and I want just :

A-X000-1XS-1XSX1-OUK-5507 I want 1XS in a column and 1XSX1 in another
A-Y00-2XXA-2XXAX-OUK-5507 I want 2XXA in a column and 2XXAX in another
A-X000-MS-MSX-OUK-5502 I want MS in a column and MSX in another
A-Y000-LR-LRR-OUK-5503 I want LR in a column and LRR in another


please help,
thanks in advance
--
Lorenzo DÃ*az
Cad Technician
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Extract text from large Text

Check out this site: http://www.j-walk.com/ss/excel/tips/tip32.htm


HTH,
JP

On Nov 13, 3:15 pm, ldiaz wrote:
I have large text like this: and I want just :

A-X000-1XS-1XSX1-OUK-5507 I want 1XS in a column and 1XSX1 in another
A-Y00-2XXA-2XXAX-OUK-5507 I want 2XXA in a column and 2XXAX in another
A-X000-MS-MSX-OUK-5502 I want MS in a column and MSX in another
A-Y000-LR-LRR-OUK-5503 I want LR in a column and LRR in another

please help,
thanks in advance
--
Lorenzo Díaz
Cad Technician



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default Extract text from large Text

These formulas should do the trick. Assuming all of your data follows the
same format, and you want to extract the text between the 2nd and 3rd
hyphens, and between the 3rd and 4th hyphens.

=MID(A1,FIND("~",SUBSTITUTE(A1,"-","~",2))+1,FIND("~",SUBSTITUTE(A1,"-","~",3))-FIND("~",SUBSTITUTE(A1,"-","~",2))-1)

=MID(A1,FIND("~",SUBSTITUTE(A1,"-","~",3))+1,FIND("~",SUBSTITUTE(A1,"-","~",4))-FIND("~",SUBSTITUTE(A1,"-","~",3))-1)

HTH,
Elkar



"ldiaz" wrote:

I have large text like this: and I want just :

A-X000-1XS-1XSX1-OUK-5507 I want 1XS in a column and 1XSX1 in another
A-Y00-2XXA-2XXAX-OUK-5507 I want 2XXA in a column and 2XXAX in another
A-X000-MS-MSX-OUK-5502 I want MS in a column and MSX in another
A-Y000-LR-LRR-OUK-5503 I want LR in a column and LRR in another


please help,
thanks in advance
--
Lorenzo DÃ*az
Cad Technician

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default Extract text from large Text

Hi Elkar,

this Works perfectly,

Thanks a lot.

--
Lorenzo DÃ*az
Cad Technician


"Elkar" wrote:

These formulas should do the trick. Assuming all of your data follows the
same format, and you want to extract the text between the 2nd and 3rd
hyphens, and between the 3rd and 4th hyphens.

=MID(A1,FIND("~",SUBSTITUTE(A1,"-","~",2))+1,FIND("~",SUBSTITUTE(A1,"-","~",3))-FIND("~",SUBSTITUTE(A1,"-","~",2))-1)

=MID(A1,FIND("~",SUBSTITUTE(A1,"-","~",3))+1,FIND("~",SUBSTITUTE(A1,"-","~",4))-FIND("~",SUBSTITUTE(A1,"-","~",3))-1)

HTH,
Elkar



"ldiaz" wrote:

I have large text like this: and I want just :

A-X000-1XS-1XSX1-OUK-5507 I want 1XS in a column and 1XSX1 in another
A-Y00-2XXA-2XXAX-OUK-5507 I want 2XXA in a column and 2XXAX in another
A-X000-MS-MSX-OUK-5502 I want MS in a column and MSX in another
A-Y000-LR-LRR-OUK-5503 I want LR in a column and LRR in another


please help,
thanks in advance
--
Lorenzo DÃ*az
Cad Technician

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Extract text from large Text

You can use this array formula, although for some reason I thought it
would be more elegant than the hard-coded alternative. I'm assuming
your large text is in column A, then with B1:E1 selected, paste this
into the formula bar and press Ctrl+Shift+Enter (instead of just
Enter):

=TRANSPOSE(MID(A1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW($1:$4)))
+1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW($2:$5)))-
FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW($1:$4)))-1))

You will get this result:

A-X000-1XS-1XSX1-OUK-5507 X000 1XS 1XSX1 OUK
A-Y00-2XXA-2XXAX-OUK-5507 Y00 2XXA 2XXAX OUK
A-X000-MS-MSX-OUK-5502 X000 MS MSX OUK
A-Y000-LR-LRR-OUK-5503 Y000 LR LRR OUK

The inner four - separated elements are placed in individual cells.
This technique can be applied to any number of dashes, simply by
modifying the ROW($1:$4) reference. For example, if you use this
starting large text:

A-X000-1XS-1XSX1-OUK-5507-BY65K-1SX2M-00952

You use this formula:

=TRANSPOSE(MID(A1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW($1:$7)))
+1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW($2:$8)))-
FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW($1:$7)))-1))

You will get these elements in separate cells:

X000 1XS 1XSX1 OUK 5507 BY65K 1SX2M


One problem with this approach is potential errors. Instead of coding
ISERROR() type formulas, you can instead count the number of dashes
before you begin, like this:

=MID(A1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW(INDIRECT("1:"&(LEN(A1)-
LEN(SUBSTITUTE(A1,"-","")))-1))))
+1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW(INDIRECT("2:"&(LEN(A1)-
LEN(SUBSTITUTE(A1,"-","")))))))-
FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW(INDIRECT("1:"&(LEN(A1)-
LEN(SUBSTITUTE(A1,"-",""))-1)))))-1)

This will only results in rows (you have to array-enter it in cells
J1:J7, for example). The column equivalent formula will only work in
Excel 2007, due to the number of nested functions:

=TRANSPOSE(MID(A1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW(INDIRECT("1:"&(LEN(A1)-
LEN(SUBSTITUTE(A1,"-","")))-1))))
+1,FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW(INDIRECT("2:"&(LEN(A1)-
LEN(SUBSTITUTE(A1,"-","")))))))-
FIND(CHAR(200),SUBSTITUTE(A1,"-",CHAR(200),ROW(INDIRECT("1:"&(LEN(A1)-
LEN(SUBSTITUTE(A1,"-",""))-1)))))-1))

Anyway, sounds like you already got your answer, but I thought you
might find this useful.



On Nov 13, 3:15 pm, ldiaz wrote:
I have large text like this: and I want just :

A-X000-1XS-1XSX1-OUK-5507 I want 1XS in a column and 1XSX1 in another
A-Y00-2XXA-2XXAX-OUK-5507 I want 2XXA in a column and 2XXAX in another
A-X000-MS-MSX-OUK-5502 I want MS in a column and MSX in another
A-Y000-LR-LRR-OUK-5503 I want LR in a column and LRR in another

please help,
thanks in advance
--
Lorenzo Díaz
Cad Technician



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
How to embed large number of variables in text inside a text box? Riva Chase Excel Discussion (Misc queries) 0 October 30th 07 01:42 AM
Text not continuing to wrap for large block of text in Excel cell Mandra Charts and Charting in Excel 1 May 15th 06 07:13 PM
Not all text wraps in a cell containing large amount of text Kris Excel Discussion (Misc queries) 3 December 23rd 05 04:25 PM
Large amount of text in cells - Problem text.xls (0/1) Patrick Excel Discussion (Misc queries) 3 May 5th 05 04:10 PM
Large amount of text in cells - Problem text.xls (1/1) Patrick Excel Discussion (Misc queries) 0 May 5th 05 01:23 PM


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