Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do i use the roundup function | Excel Worksheet Functions | |||
roundup function | Excel Discussion (Misc queries) | |||
ROUNDUP Function | Excel Discussion (Misc queries) | |||
Roundup Function | Excel Worksheet Functions | |||
Roundup Function | Excel Discussion (Misc queries) |