Determine if number is even or odd

S

SGURDON

I am creating a query and I need something similar to the
Excel ISODD function. I have a string and depending on
whether a certain part is even or odd us essential. A
sample string is A 101-155-E. I need a way to determine
if the "155" is even or odd. I am dealing with about 5000
of these strings and they need to be divided by the even
and odd, among other things. I have been taking the file
into Excel to do this but would like to do it all in
Access.
Thanks
 
F

fredg

I am creating a query and I need something similar to the
Excel ISODD function. I have a string and depending on
whether a certain part is even or odd us essential. A
sample string is A 101-155-E. I need a way to determine
if the "155" is even or odd. I am dealing with about 5000
of these strings and they need to be divided by the even
and odd, among other things. I have been taking the file
into Excel to do this but would like to do it all in
Access.
Thanks

You have 2 problems to resolve.
1) separate the 155 from the balance of the field data.

2) Determine if it's even or odd

Exp: IIf(Val(Mid([FieldName],InStr([FieldName],"-")+1)) Mod
2=0,"Even","Odd")
 

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

Top