Next highest whole number

  • Thread starter Thread starter klp
  • Start date Start date
K

klp

How would I take a value from a calculation and adjust it to be the next
highest whole number?

For example:

20 * 8.888 = 177.776 / 4 = 44.444

The 44.444 needs to be to the next highest whole number. So then I can take
the 44.444 which would be 45 and multiply that by my next part of the
calculation to get a whole number no decimals.

Make sense?

Thanks in advance.
Kim
 
I guess I didn't make myself very clear. I know about the round function but
that's not exactly what I'm looking for. In looking through some functions, I
found the int function. I need to to round to the nearest whole integer. So
if I had a range of numbers from 44.100 - 44.999 then I would want it to go
to 45 regardless of decimal.


Look in Access Help for the Round() function

jmonty
How would I take a value from a calculation and adjust it to be the next
highest whole number?
[quoted text clipped - 11 lines]
Thanks in advance.
Kim
 
just write a function to do this. it would be easy.

if int(yourval) <> yourval then yourval = int(yourval)+1

I guess I didn't make myself very clear. I know about the round function but
that's not exactly what I'm looking for. In looking through some functions, I
found the int function. I need to to round to the nearest whole integer. So
if I had a range of numbers from 44.100 - 44.999 then I would want it to go
to 45 regardless of decimal.


Look in Access Help for the Round() function

jmonty
How would I take a value from a calculation and adjust it to be the next
highest whole number?
[quoted text clipped - 11 lines]
Thanks in advance.
Kim


--
Charles E. Vopicka's (Chuck) : (e-mail address removed)

Database Management, GIS Specialist and Research Assistant

Forest Biometrics Research Institute
University of Montana - College of Forestry and Conservation
Missoula, MT 59812
United States of America

Phone:
(406)243-4526
(406)243-4264
(406)549-0647 (Home)

:-) HAVE A NICE DAY (-:

"UNLESS" (The Lorax, by Dr. Seuss)
 
Try this instead:
http://support.microsoft.com/?kbid=209996


jmonty


klp via AccessMonster.com said:
I guess I didn't make myself very clear. I know about the round function but
that's not exactly what I'm looking for. In looking through some functions, I
found the int function. I need to to round to the nearest whole integer. So
if I had a range of numbers from 44.100 - 44.999 then I would want it to go
to 45 regardless of decimal.


Look in Access Help for the Round() function

jmonty
How would I take a value from a calculation and adjust it to be the next
highest whole number?
[quoted text clipped - 11 lines]
Thanks in advance.
Kim
 
klp via AccessMonster.com said:
I guess I didn't make myself very clear. I know about the round function
but
that's not exactly what I'm looking for. In looking through some
functions, I
found the int function. I need to to round to the nearest whole integer.
So
if I had a range of numbers from 44.100 - 44.999 then I would want it to
go
to 45 regardless of decimal.

45 ISN'T the nearest whole integer to 44.100. 44 is. To actually round
to the nearest integer, use

Int(n + .5) where n is a non-negative number.

Tom Lake
 
First, read the header Next HIGHEST Number
Next, if you use his example of 44.444 wanting it to be 45 (Next HIGHEST
number),

Int(44.444 + .5) returns 44
 
Klatuu said:
First, read the header Next HIGHEST Number
Next, if you use his example of 44.444 wanting it to be 45 (Next HIGHEST
number)

My interpretation is, assuming three fixed decimal places, that:

· values from -44.999 to -44.100 inclusive round to -45;
· values from -44.099 to -44.000 inclusive round to -44;
· values from 44.000 to 44.099 inclusive round to 44;
· values from 44.100 to 44.999 inclusive round to 45.

Therefore:

SELECT 44.099 AS yourval,
FIX(yourval)
+ IIF(
ABS(yourval - FIX(yourval)) BETWEEN 0.100 AND 0.999,
IIF(yourval < 0, -1, 1),
0
) AS yourval_rounded

Jamie.

--
 
Back
Top