Return anything to the right of a character

  • Thread starter Thread starter Newbie
  • Start date Start date
N

Newbie

Hi
I have a field that contains account number in the format

AAA/1
AAA/10
AAA/15

I would like to extract anything that is to the right of the "/" character.
If the / character doesn't exist then to return 1

How can I do this?
 
Hi,

Instr() will find the position of the first occurrence of one string within
another.
Mid() will return a variant (String) containing a specified number of
characters from a string.

Mid(SearchString, 1, Instr(SearchString, SearchChar))

Hope this helps.
 
Hi,

Might need to subtract 1 from the Instr.

Mid(SearchString, 1, Instr(SearchString, SearchChar) - 1)
 
It was close, just needs a few adjustments ...

? Mid("AAA/10", InStr(1,"AAA/10", "/") + 1)
10

See Mid Function and InStr Function in the help file for details.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Thanks works a treat
Brendan Reynolds said:
It was close, just needs a few adjustments ...

? Mid("AAA/10", InStr(1,"AAA/10", "/") + 1)
10

See Mid Function and InStr Function in the help file for details.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Back
Top