equivilant to trunc function in access

G

Grd

Hi there,

I used the round function but it rounded my numbers - I really just want to
cut of the decimals at the 2 decimal. I read about the trunc function on the
internet however it only works in excel and I need to do this in a query.

Any help would be great as my numbers are off by a little.

Thanks

Suzanne
 
M

Michel Walsh

int(100*x)/100

should do.


? int(100*1.23456)/100, int(-1.23456*100)/100, fix(-1.23456*100)/100
1.23 -1.24 -1.23



Vanderghast, Access MVP
 
M

Marshall Barton

Grd said:
I used the round function but it rounded my numbers - I really just want to
cut of the decimals at the 2 decimal. I read about the trunc function on the
internet however it only works in excel and I need to do this in a query.


Try using:

Int(thefield * 100) / 100
 
G

Grd

tx v much


Michel Walsh said:
int(100*x)/100

should do.


? int(100*1.23456)/100, int(-1.23456*100)/100, fix(-1.23456*100)/100
1.23 -1.24 -1.23



Vanderghast, Access MVP
 
M

Marshall Barton

Michel makes a good point. If any of your numbers might be
negative, you probably want to use Fix instead of Int. If
all your numbers are guaranteed to be non-negative, then
both functions will yield the same result.
 

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