Find a string

  • Thread starter kingston via AccessMonster.com
  • Start date
K

kingston via AccessMonster.com

Left(Mid(Mid(string,Instr(string,"-")+1),Instr(Mid(string,Instr(string,"-")+1)
,"-")+1),Instr(Mid(Mid(string,Instr(string,"-")+1),Instr(Mid(string,Instr
(string,"-")+1),"-")+1),"-")+1),5)

I hope I got all of the parentheses right. Anyway, you get the idea.
 
J

John Spencer

The following should work

Mid(TheString,
Instr(Instr(Instr(1,TheString,"-")+1,TheString,"-")+1,TheString,"-")+1,5)

Each Instr starts at the position + 1 of the inner Instr.
 
K

Kurt

Thanks for the help-worked great,
K

John Spencer said:
The following should work

Mid(TheString,
Instr(Instr(Instr(1,TheString,"-")+1,TheString,"-")+1,TheString,"-")+1,5)

Each Instr starts at the position + 1 of the inner Instr.
 
F

fredg

I have a string of numbers:

40-M-06-03147-01

I would like a function to return 03147 from the string.

There will always be 3 dashes in the string before the 5 number string I
want to retrieve.

Thanks in advanve for any help

K.

How about fixing your clock. Today is the 19th.
 
T

tina

fix the date on your PC, please. i can never figure out the international
dateline thing, but it's 1:31 pm Sat 10/21/06 where i am - it can't possibly
be later than Sun 10/22/06 anywhere else in the world....and it's certainly
not 10/29/06.
 
K

Kurt

I have a string of numbers:

40-M-06-03147-01

I would like a function to return 03147 from the string.

There will always be 3 dashes in the string before the 5 number string I
want to retrieve.

Thanks in advanve for any help

K.
 
Top