Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default RoundUp Function

or without worksheet formulae

myVar = (2.1+1)*10\10

--

HTH

Bob Phillips

"LSB" wrote in message
...
I would like to use this function in my macro. As I found
this function in the Excel Help, but when I use it in
thecoding it prompts me the error message 'Sub or Function
not Defined'. I would like to know how can I work on this
error.
Actually I want to round up my figure, for example

2.1 roundup to 3
3.5 roundup to 4
6.9 roundup to 7

Ccan please somebody help me on this. Thanks in advance.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default RoundUp Function

But does it work for 2.9?

--

HTH

Bob Phillips

"Thomas" wrote in message ...
How about,
var = CLng(2.1) + 1



Bob Phillips wrote:

or without worksheet formulae

myVar = (2.1+1)*10\10

--

HTH

Bob Phillips

"LSB" wrote in message
...
I would like to use this function in my macro. As I found
this function in the Excel Help, but when I use it in
thecoding it prompts me the error message 'Sub or Function
not Defined'. I would like to know how can I work on this
error.
Actually I want to round up my figure, for example

2.1 roundup to 3
3.5 roundup to 4
6.9 roundup to 7

Ccan please somebody help me on this. Thanks in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default RoundUp Function

or even
2.9 \ 1

--

HTH

Bob Phillips

"Thomas" wrote in message ...

Int(2.9) + 1


Bob Phillips wrote:

But does it work for 2.9?

--

HTH

Bob Phillips

"Thomas" wrote in message ...
How about,
var = CLng(2.1) + 1



Bob Phillips wrote:

or without worksheet formulae

myVar = (2.1+1)*10\10

--

HTH

Bob Phillips

"LSB" wrote in message
...
I would like to use this function in my macro. As I found
this function in the Excel Help, but when I use it in
thecoding it prompts me the error message 'Sub or Function
not Defined'. I would like to know how can I work on this
error.
Actually I want to round up my figure, for example

2.1 roundup to 3
3.5 roundup to 4
6.9 roundup to 7

Ccan please somebody help me on this. Thanks in advance.



  #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


Reply
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 03:30 PM.

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"