As far as I know there isn't a specific function to do exactly what you
want, but the following will work:
If Int(YourNum) = (YourNum) Then
Int(YourNum)
Else
Int(YourNum) + 1
End If
Int takes the integer portion of the number and ignores the rest. The
integer portion of 4.0 is 4. If this equals 4.0 (and it does) then you want
4 as your value. If your number is 4.3, the integer portion is 4, but 4
doesn't equal 4.3 so you take the integer portion, which is 4, and add 1 to
round it to the next whole number.
Hope this helps,
Christopher Gitzlaff
Manager - Information Systems & Technology
Major Industries, Inc.
Phone: 715-842-4616
Fax: 715-848-3336
-----Original Message-----
From:
sarah.vareschi@... [mailto:
sarah.vareschi@...]
Sent: Thursday, April 04, 2002 1:22 PM
To:
vantage@yahoogroups.com
Subject: [Vantage] [off-topic] Visual Basic Question - rounding up?
I am setting a field value based on equation. The resulting files needs to
be an integer. The caluculation may result ina fraction. I want the
calculated number to always round up to the next integer value to set the
field. (ex. 4.2 = 5, 4.6 = 5, 4.0 = 4). If anyone know how to do this, I
would GREATLy appreciate it!!!
Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have
already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and
Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/links
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/