Extracting numbers from end of string

Malcy

Registered User.
Local time
Today, 15:01
Joined
Mar 25, 2003
Messages
584
I have a string which is a combination of numbers and letters. I want to extract the end digit (always a number), or, if it is greater than 9, then the two digits. The format of the string is along the lines 18G003-2-4 (they are agar plate codes for refining fungal cultures). So I am trying to catch the final "4" which works fine using
strCode2 = Right(strPlateCode, 1)
However, if the string were 18G003-2-11 then I want to catch the "11" not just the final "1".
The initial code may well only have one "-" in it rather than the two in the example I have given.
Any insights into understanding this would be most appeciated.
Thanks

Malcy
 
Code:
Mid([string], InstrRev([string],"-") + 1)
 
Brilliant. Thank you very much. Worked a treat.
 

Users who are viewing this thread

Back
Top Bottom