rounding problems

V

voodoo

I have a calculated field on a form that produces a number with several
decimal places. Access will automatically round up the result to the
nearest tenth.

for example. the calculated field produces: 54.9876543210
access will round up to: 55.0
I want it to display: 54.9

How do I stop Access from rounding this calculated number.

J

Jeff Boyce

Perhaps there's a difference of definition for "rounding".

The standard 'rule' for rounding would turn 54.98... into 55.0, rounded to
the nearest tenth.

If what you want is to discard all decimal places after the tenth, take a
look at the Trunc() function.

Regards

Jeff Boyce
Microsoft Office/Access MVP

V

voodoo

Thanks Jeff for the timely response,

But I can't seem to find the Trunc() function in Access. I went ahead and
tried using it but Access didn't recognize it. Excel has a Trunc function
but Access does not. Go figure! Any other suggestions?

G

Gina Whipp

Voodoo,

I think the Trunc() funstion applies to Excel, maybe SQL. Try this instead:
=Int([YourField]*100)/100

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

V

voodoo

Thanks Gina,

That seemed to do the trick although I'm not sure why?

To get the number to show only one decimal I did have to change your
equation
from: =Int([YourField]*100)/100
to: =Int([YourField]*10)/10

thanks to both of you for your help, greatly appreciated!

happy programming

Gina Whipp said:
Voodoo,

I think the Trunc() funstion applies to Excel, maybe SQL. Try this

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

voodoo said:
Thanks Jeff for the timely response,

them. But I can't seem to find the Trunc() function in Access. I went
ahead and tried using it but Access didn't recognize it. Excel has a
Trunc function but Access does not. Go figure! Any other suggestions?

J

Jeff Boyce

I knew I'd seen it somewhere ... <g>

As another alternative, setting a reference to the Excel object model and
use Excel's Trunc() function in Access.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Gina Whipp said:
Voodoo,

I think the Trunc() funstion applies to Excel, maybe SQL. Try this

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

voodoo said:
Thanks Jeff for the timely response,

them. But I can't seem to find the Trunc() function in Access. I went
ahead and tried using it but Access didn't recognize it. Excel has a
Trunc function but Access does not. Go figure! Any other suggestions?

G

Gina Whipp

Voodoo,

Oops, one extra '0', sorry about that. Somewhere there is a simple
explanation but I don't remember it.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

voodoo said:
Thanks Gina,

That seemed to do the trick although I'm not sure why?

To get the number to show only one decimal I did have to change your
equation
from: =Int([YourField]*100)/100
to: =Int([YourField]*10)/10

thanks to both of you for your help, greatly appreciated!

happy programming

Gina Whipp said:
Voodoo,

I think the Trunc() funstion applies to Excel, maybe SQL. Try this

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

voodoo said:
Thanks Jeff for the timely response,

them. But I can't seem to find the Trunc() function in Access. I went
ahead and tried using it but Access didn't recognize it. Excel has a
Trunc function but Access does not. Go figure! Any other suggestions?

Perhaps there's a difference of definition for "rounding".

The standard 'rule' for rounding would turn 54.98... into 55.0, rounded
to the nearest tenth.

If what you want is to discard all decimal places after the tenth, take
a look at the Trunc() function.

Regards

Jeff Boyce
Microsoft Office/Access MVP

I have a calculated field on a form that produces a number with several
decimal places. Access will automatically round up the result to the
nearest tenth.

for example. the calculated field produces: 54.9876543210
access will round up to: 55.0
I want it to display: 54.9

How do I stop Access from rounding this calculated number.

G

Gina Whipp

Jeff,

Can you help Voodoo out with why this (=Int([YourField]*100)/100) works? I
just don't remember WHY it works.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Jeff Boyce said:
I knew I'd seen it somewhere ... <g>

As another alternative, setting a reference to the Excel object model and
use Excel's Trunc() function in Access.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Gina Whipp said:
Voodoo,

I think the Trunc() funstion applies to Excel, maybe SQL. Try this

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

voodoo said:
Thanks Jeff for the timely response,

them. But I can't seem to find the Trunc() function in Access. I went
ahead and tried using it but Access didn't recognize it. Excel has a
Trunc function but Access does not. Go figure! Any other suggestions?

Perhaps there's a difference of definition for "rounding".

The standard 'rule' for rounding would turn 54.98... into 55.0, rounded
to the nearest tenth.

If what you want is to discard all decimal places after the tenth, take
a look at the Trunc() function.

Regards

Jeff Boyce
Microsoft Office/Access MVP

I have a calculated field on a form that produces a number with several
decimal places. Access will automatically round up the result to the
nearest tenth.

for example. the calculated field produces: 54.9876543210
access will round up to: 55.0
I want it to display: 54.9

How do I stop Access from rounding this calculated number.

J

Jeff Boyce

"fraid I can't ... if it needs to be tenths, I don't see how Int() gets
there!

Regards

Jeff Boyce
Microsoft Office/Access MVP

Gina Whipp said:
Jeff,

Can you help Voodoo out with why this (=Int([YourField]*100)/100) works?
I just don't remember WHY it works.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Jeff Boyce said:
I knew I'd seen it somewhere ... <g>

As another alternative, setting a reference to the Excel object model and
use Excel's Trunc() function in Access.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Gina Whipp said:
Voodoo,

I think the Trunc() funstion applies to Excel, maybe SQL. Try this

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

Thanks Jeff for the timely response,

them. But I can't seem to find the Trunc() function in Access. I went
ahead and tried using it but Access didn't recognize it. Excel has a
Trunc function but Access does not. Go figure! Any other suggestions?

Perhaps there's a difference of definition for "rounding".

The standard 'rule' for rounding would turn 54.98... into 55.0,
rounded to the nearest tenth.

If what you want is to discard all decimal places after the tenth,
take a look at the Trunc() function.

Regards

Jeff Boyce
Microsoft Office/Access MVP

I have a calculated field on a form that produces a number with
several decimal places. Access will automatically round up the result
to the nearest tenth.

for example. the calculated field produces: 54.9876543210
access will round up to: 55.0
I want it to display: 54.9

How do I stop Access from rounding this calculated number.

G

Gina Whipp

Someone told me once and it was so simple... HOPEFULLY, they will see this
and provide an answer. Of course, I know what I will be doing tonight!

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Jeff Boyce said:
"fraid I can't ... if it needs to be tenths, I don't see how Int() gets
there!

Regards

Jeff Boyce
Microsoft Office/Access MVP

Gina Whipp said:
Jeff,

Can you help Voodoo out with why this (=Int([YourField]*100)/100) works?
I just don't remember WHY it works.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

Jeff Boyce said:
I knew I'd seen it somewhere ... <g>

As another alternative, setting a reference to the Excel object model
and use Excel's Trunc() function in Access.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Voodoo,

I think the Trunc() funstion applies to Excel, maybe SQL. Try this

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" -
Tremors II

http://www.regina-whipp.com/index_files/TipList.htm

Thanks Jeff for the timely response,

them. But I can't seem to find the Trunc() function in Access. I went
ahead and tried using it but Access didn't recognize it. Excel has a
Trunc function but Access does not. Go figure! Any other
suggestions?

Perhaps there's a difference of definition for "rounding".

The standard 'rule' for rounding would turn 54.98... into 55.0,
rounded to the nearest tenth.

If what you want is to discard all decimal places after the tenth,
take a look at the Trunc() function.

Regards

Jeff Boyce
Microsoft Office/Access MVP

I have a calculated field on a form that produces a number with
several decimal places. Access will automatically round up the
result to the nearest tenth.

for example. the calculated field produces: 54.9876543210
access will round up to: 55.0
I want it to display: 54.9

How do I stop Access from rounding this calculated number.

J

John W. Vinson

Thanks Gina,

That seemed to do the trick although I'm not sure why?

To get the number to show only one decimal I did have to change your
equation
from: =Int([YourField]*100)/100
to: =Int([YourField]*10)/10

PMFJI but...

54.9876543210 * 10 is 549.876543210

Int just takes the integer part, discarding (not rounding) the fraction, so
Int(54.9876543210*10) is 549.

Dividing that by 10 gives 54.9.

G

Gina Whipp

THANK YOU THANK THANK YOU

I knew it was something simple.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

John W. Vinson said:
Thanks Gina,

That seemed to do the trick although I'm not sure why?

To get the number to show only one decimal I did have to change your
equation
from: =Int([YourField]*100)/100
to: =Int([YourField]*10)/10

PMFJI but...

54.9876543210 * 10 is 549.876543210

Int just takes the integer part, discarding (not rounding) the fraction,
so
Int(54.9876543210*10) is 549.

Dividing that by 10 gives 54.9.