Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default Extract between Pipe symbol

Can someone please tell me if it is possible to write a formula that would
extract all the text that exists between the vertical bar symbol "|".

Example in the following Cell A1 contains:
W213FR|BADC12GW34-14|SPACER, DEG

I want to extract only "BADC12GW34-14" and put it in another cell, say B1.
Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,389
Default Extract between Pipe symbol

This seems to work:

=MID(A1,FIND("|",A1)+1,FIND("|",MID(A1,FIND("|",A1 )+1,99))-1)

Hopefully someone else will come up with a shorter version.

Regards,
Fred.

"Tony S." wrote in message
...
Can someone please tell me if it is possible to write a formula that would
extract all the text that exists between the vertical bar symbol "|".

Example in the following Cell A1 contains:
W213FR|BADC12GW34-14|SPACER, DEG

I want to extract only "BADC12GW34-14" and put it in another cell, say B1.
Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 66
Default Extract between Pipe symbol

Enter the following in cell B1:


=MID(A1,FIND("|",A1)+1,FIND("|",A1,FIND("|",A1)+1)-FIND("|",A1)-1)



"Tony S." wrote:

Can someone please tell me if it is possible to write a formula that would
extract all the text that exists between the vertical bar symbol "|".

Example in the following Cell A1 contains:
W213FR|BADC12GW34-14|SPACER, DEG

I want to extract only "BADC12GW34-14" and put it in another cell, say B1.
Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Extract between Pipe symbol

If the text to test is in A1, you can use

=MID(A1,(FIND("|",A1,1)+1),(FIND("|",A1,(FIND("|", A1,1)+1)+1))-(FIND("|",A1,1)+1))

This will return a #VALUE error if there are not two | characters in
A1. You can test for that condition with the expanded formula

=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"|","")) <2,NA(),
MID(A1,(FIND("|",A1,1)+1),(FIND("|",A1,(FIND("|",A 1,1)+1)+1))-(FIND("|",A1,1)+1)))



Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 6 Nov 2008 14:54:04 -0800, Tony S.
wrote:

Can someone please tell me if it is possible to write a formula that would
extract all the text that exists between the vertical bar symbol "|".

Example in the following Cell A1 contains:
W213FR|BADC12GW34-14|SPACER, DEG

I want to extract only "BADC12GW34-14" and put it in another cell, say B1.
Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default Extract between Pipe symbol

Fred & FiluDlidu,

Your answers were exactly what I needed. Thank you!
Chip, a special thanks to you for going the extra mile with your error
trapping example. Great stuff!

Tony

"Chip Pearson" wrote:

If the text to test is in A1, you can use

=MID(A1,(FIND("|",A1,1)+1),(FIND("|",A1,(FIND("|", A1,1)+1)+1))-(FIND("|",A1,1)+1))

This will return a #VALUE error if there are not two | characters in
A1. You can test for that condition with the expanded formula

=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"|","")) <2,NA(),
MID(A1,(FIND("|",A1,1)+1),(FIND("|",A1,(FIND("|",A 1,1)+1)+1))-(FIND("|",A1,1)+1)))



Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 6 Nov 2008 14:54:04 -0800, Tony S.
wrote:

Can someone please tell me if it is possible to write a formula that would
extract all the text that exists between the vertical bar symbol "|".

Example in the following Cell A1 contains:
W213FR|BADC12GW34-14|SPACER, DEG

I want to extract only "BADC12GW34-14" and put it in another cell, say B1.
Thanks!


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
Pipe-Delimited CSv File stevieb Excel Discussion (Misc queries) 3 August 7th 08 08:08 PM
Export as pipe separated Sashi[_2_] Excel Discussion (Misc queries) 2 June 20th 07 04:46 PM
Save excel file with pipe separated Vijay Kotian Excel Discussion (Misc queries) 5 November 3rd 06 06:21 PM
Extract Symbol Karen Excel Worksheet Functions 9 October 24th 06 04:20 PM
How can I save Excel am spreadsheet as pipe delimiter? Sarah Excel Discussion (Misc queries) 5 May 25th 06 08:36 PM


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