extract value

S

stevenszoe

i need assistance extract the following

12345 from 3001-12345Y
653 from 2007-653Z
23 from 4009-23p

thank you
 
O

Ofer

Asuming by your example that there are always 5 digit before to get rid of,
and one digit in the end to get rid of. if it not the case then you cant use
it

mid("3001-12345Y",6,len("3001-12345Y")-6)
 
J

JLamb

If the number of digits before the dash varies you can use this:

Mid({String},instr({string},"-",1)+1,len({string}-instr({string},"-",1)-1))
 
S

stevenszoe

both worked great. thank you both for you help!

JLamb said:
If the number of digits before the dash varies you can use this:

Mid({String},instr({string},"-",1)+1,len({string}-instr({string},"-",1)-1))
 
S

stevenszoe

actually when I use the following with a field named test I am getting #Error
in my query:

Expr1: Mid([test],InStr([test],"-",1)+1,Len([test]-InStr([test],"-",1)-1))

any ideas??
 
Top