LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default RoundUp Function

For that particular number, Int(2.9) + 1 and 2.9 \ 1 give the same result. But that's not true
if the number is 2.1. If the OP wants to always round up, the division won't work for fractional
parts < 0.5, and the first formula is flawed for whole numbers. Int(2) + 1 = 3. If I interpret
the question correctly, the result should be 2.

Maybe this will do it

Function RoundUp(x As Double)
Dim y As Double

y = Int(x)
If y = x Then
RoundUp = y
Else
RoundUp = y + 1
End If
End Function

On Fri, 8 Aug 2003 19:03:31 +0100, "Bob Phillips" wrote:

or even
2.9 \ 1


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i use the roundup function Leprechan Excel Worksheet Functions 8 June 10th 09 02:30 PM
roundup function Marge Excel Discussion (Misc queries) 3 January 15th 09 07:54 PM
ROUNDUP Function Chacky Excel Discussion (Misc queries) 1 September 5th 07 05:54 PM
Roundup Function brown_toby Excel Worksheet Functions 3 June 30th 06 06:55 PM
Roundup Function Will Excel Discussion (Misc queries) 4 February 4th 06 11:41 PM


All times are GMT +1. The time now is 06:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"