Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Sheila
 
Posts: n/a
Default delete all text to the left of???

I want to put a list in column A that will be the paths to the files I
have, (ie c:\Program Files\Common
Files\Microsoft\Stationery\signature.htm), but I wqant to delete the
path in column B, so I need a formula that will delete everything to
the left of "\". Can anyone help??

TIA

Sheila
  #2   Report Post  
cmart02
 
Posts: n/a
Default

You can create a formula, but I would go for a function in VBA instead.

You can do something like:

Function splitName(text As String) As String
txt = Split(text, "\")
splitName = txt(UBound(txt))
End Function

Which will return "signature.htm". Add the function to a module so that it
is available in the worksheet (or create an addin with the function)

Regards
Robert
  #3   Report Post  
Rob van Gelder
 
Posts: n/a
Default

Assuming your string is A1
Here is an array formula. Enter with Ctrl+Shift+Enter

=MID(A1, MAX(--(MID(A1, ROW(INDIRECT("1:" & LEN(A1))), 1)="\") *
ROW(INDIRECT("1:" & LEN(A1)))) + 1, LEN(A1))

I'm not that great at the ROW(INDIRECT( trick..
I've noticed some who are quite confident at it. I'd be happy to see
corrections.

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Sheila" wrote in message
...
I want to put a list in column A that will be the paths to the files I
have, (ie c:\Program Files\Common
Files\Microsoft\Stationery\signature.htm), but I wqant to delete the
path in column B, so I need a formula that will delete everything to
the left of "\". Can anyone help??

TIA

Sheila



  #4   Report Post  
Harlan Grove
 
Posts: n/a
Default

Sheila wrote...
I want to put a list in column A that will be the paths to the files I
have, (ie
c:\Program Files\Common Files\Microsoft\Stationery\signature.htm),
but I wqant to delete the path in column B, so I need a formula that
will delete everything to the left of "\". Can anyone help??


If you need this dynamic, then use Rob's formula. If this would be
mostly static, then copy the pathnames from col A into col B, then Edit
Replace over col B, replacing *\ with nothing.


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 can I delete ALL text boxes in Excel worksheets? Genesis Excel Discussion (Misc queries) 3 January 20th 05 03:11 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM
Text to Columns from the Left Jim Excel Worksheet Functions 2 December 20th 04 09:25 PM
Macro or Function to make text size to suite text Length? lbbss Excel Discussion (Misc queries) 4 December 14th 04 07:53 PM
Delete Columns not Containing Certain Text Dennis Excel Worksheet Functions 4 November 25th 04 09:37 PM


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