Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Extract string after specific characters

I have a worksheet with the drive paths to thousands of documents.
I would like to copy 2 sets of numbers (as string) to adjacent cells.
Example:
A1 contains "D:\OtherFiles\CLOSED\K\12-345 Smith, John\001 Estate
Planning\Correspondence\Memo.doc"
I need to extract the 6 characters after the 4th backslash ("12-345")
to B1, and the 3 characters after the 5th backslash ("001") to C1.
These numbers all fall after the 4th and 5th backslashes, but at
varying character lengths and the numbers are variable, between 01-001
and 99-999.
How do I search for those backslashes, and then copy the data to the
next cells?
Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Extract string after specific characters

Hi

=MID(SUBSTITUTE(A1,"\","^",4),FIND("^",SUBSTITUTE( A1,"\","^",4))+1,6)

and

=MID(SUBSTITUTE(A1,"\","^",5),FIND("^",SUBSTITUTE( A1,"\","^",5))+1,3)

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Extract string after specific characters

Cool, thanks! That's close....
The only problem is that I need the data in B1 and C1 to be the actual
data from A1, and not the underlying formula itself.
Is there vb that can do this?
Sorry I didn't specify in the original post.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Extract string after specific characters

Copy these 2 cells and paste special as values. See Edit menu, then Paste
Special.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


" wrote:

Cool, thanks! That's close....
The only problem is that I need the data in B1 and C1 to be the actual
data from A1, and not the underlying formula itself.
Is there vb that can do this?
Sorry I didn't specify in the original post.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Extract string after specific characters

We can deal with that!
Thanks much for your help!



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Extract string after specific characters

On Wed, 11 Jul 2007 03:20:01 -0700, Wigi
wrote:

Nice Ron


Thanks



c.Offset(0, 1).ClearContents
c.Offset(0, 1).NumberFormat = "@"
c.Offset(0, 2).ClearContents
c.Offset(0, 2).NumberFormat = "@"

could be done in 2 lines with a Resize.


Good suggestion:


c.Offset(0, 1).Resize(1, 2).ClearContents
c.Offset(0, 1).Resize(1, 2).NumberFormat = "@"


--ron
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
Extract characters from Right of string ashg657 Excel Worksheet Functions 5 July 30th 09 11:16 AM
How to extract specific text from a string of characters rushdhih Excel Worksheet Functions 7 February 19th 09 09:58 AM
Formula to extract a specific word from text string Dinesh Excel Worksheet Functions 4 November 3rd 06 08:35 PM
Extract specific value from a long text string Dinesh Excel Worksheet Functions 4 August 11th 06 04:24 AM
Text String - Specific Characters Kiser Excel Worksheet Functions 6 February 10th 06 02:43 AM


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