always round up

1. Senior Member
Join Date
Dec 1969
Posts
299

always round up

is there a function that takes a decimal number and never rounds up? I know I could convert it to a string and strip off everything after the decimal, then convert back to an integer, but was just curious if there was an easier way

2. Senior Member
Join Date
Dec 1969
Posts
999

RE: always round up

use INT

3. Senior Member
Join Date
Dec 1969
Posts
999

RE: always round up

here you go<BR><BR>Int, Fix Functions<BR>See Also<BR>CInt Function &#124 Round Function<BR>Requirements<BR>Version 1 <BR>Returns the integer portion of a number.<BR><BR>Int(number)<BR>Fix(number)<BR>The number argument can be any valid numeric expression. If number contains Null, Null is returned.<BR><BR>Remarks<BR>Both Int and Fix remove the fractional part of number and return the resulting integer value.<BR><BR>The difference between Int and Fix is that if number is negative, Int returns the first negative integer less than or equal to number, whereas Fix returns the first negative integer greater than or equal to number. For example, Int converts -8.4 to -9, and Fix converts -8.4 to -8.<BR><BR>Fix(number) is equivalent to: <BR><BR>Sgn(number) * Int(Abs(number))<BR>The following examples illustrate how the Int and Fix functions return integer portions of numbers: <BR><BR>MyNumber = Int(99.8) &#039; Returns 99.<BR>MyNumber = Fix(99.2) &#039; Returns 99.<BR>MyNumber = Int(-99.8) &#039; Returns -100.<BR>MyNumber = Fix(-99.8) &#039; Returns -99.<BR>MyNumber = Int(-99.2) &#039; Returns -100.<BR>MyNumber = Fix(-99.2) &#039; Returns -99.<BR>

4. Senior Member
Join Date
Dec 1969
Posts
11,334

Could be tough

Are you saying 1.00001 will be 2 then?<BR><BR>basically, you&#039;ll have to look at anything past the decimal point... if there&#039;s a value &#062; 0, you&#039;ll have to convert to integer and add one.<BR><BR>If you&#039;re looking at normal rounding, look at Round().

5. Senior Member
Join Date
Dec 1969
Posts
200

RE: always round up

you can convert your number into cDBL(), cCur() to preserve decimals.

6. Senior Member
Join Date
Dec 1969
Posts
11,334

crap did I read that wrong

7. Senior Member
Join Date
Dec 1969
Posts
200

RE: always round up

i reckon 100% u need to use the FIX() function.

8. Senior Member
Join Date
Dec 1969
Posts
299

RE: crap did I read that wrong

i know, i&#039;m sorry. didn&#039;t re-read i guess

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•