I am looking for a locate function, WHat I need to do is
find the length of a string up to the first instance of
particular character and determine how many characters are
before it, then use that result in a left statement
something like
x=length(string,locate("-"))
left(string,x)
x = Instr(String,"-")
y = left(string,x)
--
regards,
Tom Ogilvy
"Nigel Bennett" <nigelben@yahoo.com> wrote in message
news:11d301c5534c$00cf4250$a401280a@phx.gbl...
> I am looking for a locate function, WHat I need to do is
> find the length of a string up to the first instance of
> particular character and determine how many characters are
> before it, then use that result in a left statement
>
> something like
>
> x=length(string,locate("-"))
> left(string,x)
>
Nigel
Try the InStr() function
InStr(1,"Nick Hodge","o")
returns 7
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@zen.co.uk.ANDTHIS
"Nigel Bennett" <nigelben@yahoo.com> wrote in message
news:11d301c5534c$00cf4250$a401280a@phx.gbl...
>I am looking for a locate function, WHat I need to do is
> find the length of a string up to the first instance of
> particular character and determine how many characters are
> before it, then use that result in a left statement
>
> something like
>
> x=length(string,locate("-"))
> left(string,x)
>
Try the find function in Excel or the instr() in VBA
"Nigel Bennett" wrote:
> I am looking for a locate function, WHat I need to do is
> find the length of a string up to the first instance of
> particular character and determine how many characters are
> before it, then use that result in a left statement
>
> something like
>
> x=length(string,locate("-"))
> left(string,x)
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks