'Right' Function

  • Thread starter Thread starter deiopajw
  • Start date Start date
D

deiopajw

I have a field called Product.
There are items such as:
AB1000
AB400
AB1100

I want to extract only the numbers in the product.
I tried to enter the following in the source control of a field I created
to simply show the number section of the product:
=Right([Product],4)
However, product AB400 would show up as B400.
Can anyone suggest how to overcome this problem.
 
Hi

Use the following code:

Mid([product],3,20)

where 3 is the first letter of the string that you want to extract
and 20 is the number of characters thereafter (if there are only four
characters after then the remaining 16 are ignored.

Kind regards

Colin
 
If the left part is always 2 characters and it is the numeric part that
varies then use the mid function instead of the right function
=Mid([Product],3)
 
If it is always the first two characters that are non-numeric, then
Mid$([Product], 3) will get you the numeric portion.

If the number of non-numeric characters varies, you'll need a custom VBA
function.
 
Actually, the 3rd parameter is optional in the Mid function.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


colin said:
Hi

Use the following code:

Mid([product],3,20)

where 3 is the first letter of the string that you want to extract
and 20 is the number of characters thereafter (if there are only four
characters after then the remaining 16 are ignored.

Kind regards

Colin

deiopajw said:
I have a field called Product.
There are items such as:
AB1000
AB400
AB1100

I want to extract only the numbers in the product.
I tried to enter the following in the source control of a field I created
to simply show the number section of the product:
=Right([Product],4)
However, product AB400 would show up as B400.
Can anyone suggest how to overcome this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top