String manipulation!!
On Mon, 18 Oct 2004 03:07:02 -0700, "Mannyluk"
wrote:
Hi,
In my Excel sheet I have a cell with the following string:
Field\SM-A1\SEM A P03\Hydraulic sensors\PT01-LP Supply
What I need to do is extract everything after the 2nd backslash and before
the 3rd.
Leaving:
SEM A P03
I can't just count as the value could change from either end i.e SM-A1 could
become SM-A100. So as the string will change, I need to test the string, and
I can't think how....
Any help would be great!
Thanks in advance
Manny
As a worksheet function:
=MID(A1,FIND("~",SUBSTITUTE(A1,"\","~",2))+1,
FIND("~",SUBSTITUTE(A1,"\","~",3))-
FIND("~",SUBSTITUTE(A1,"\","~",2))-1)
As a VBA function in Excel 2000 and later:
================
Function foo(str As String)
Dim temp
temp = Split(str, "\")
foo = temp(2)
End Function
==================
--ron
|