ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rounding Up (https://www.excelbanter.com/excel-programming/410819-rounding-up.html)

Mike

Rounding Up
 
Im needing a code to round up not down
100.1 = needs to be 101
100.2 = needs to be 101
100.9 = needs to be 101


Sandy Mann

Rounding Up
 
Check out the CEILING() function.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Mike" wrote in message
...
Im needing a code to round up not down
100.1 = needs to be 101
100.2 = needs to be 101
100.9 = needs to be 101





Mike

Rounding Up
 
In need it to be in vba this is what I have. If the sum of
rs.Fields("SumOfRTL_QTY").Value / 10 is a decimal just round up to the next
Integer
ThisWorkbook.Worksheets(1).Range(AD & i) = _rs.Fields("SumOfRTL_QTY").Value
/ 10

"Sandy Mann" wrote:

Check out the CEILING() function.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Mike" wrote in message
...
Im needing a code to round up not down
100.1 = needs to be 101
100.2 = needs to be 101
100.9 = needs to be 101






edward

Rounding Up
 
Int(rs.Fields("SumOfRTL_QTY").Value / 10 +1))
--
Best regards,
Edward


"Mike" wrote:

In need it to be in vba this is what I have. If the sum of
rs.Fields("SumOfRTL_QTY").Value / 10 is a decimal just round up to the next
Integer
ThisWorkbook.Worksheets(1).Range(AD & i) = _rs.Fields("SumOfRTL_QTY").Value
/ 10

"Sandy Mann" wrote:

Check out the CEILING() function.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Mike" wrote in message
...
Im needing a code to round up not down
100.1 = needs to be 101
100.2 = needs to be 101
100.9 = needs to be 101






Howard Kaikow

Rounding Up
 

Public Function Ceil(dblSource As Double) As Long
Dim dblFloor As Double

dblFloor = Int(dblSource)
If dblFloor = dblSource Then
Ceil = dblFloor
Else
Ceil = dblFloor + 1
End If
End Function



Bob Phillips

Rounding Up
 
ThisWorkbook.Worksheets(1).Range(AD & i) =
Application.Ceiling(_rs.Fields("SumOfRTL_QTY").Val ue / 10,1)


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Mike" wrote in message
...
In need it to be in vba this is what I have. If the sum of
rs.Fields("SumOfRTL_QTY").Value / 10 is a decimal just round up to the
next
Integer
ThisWorkbook.Worksheets(1).Range(AD & i) =
_rs.Fields("SumOfRTL_QTY").Value
/ 10

"Sandy Mann" wrote:

Check out the CEILING() function.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Mike" wrote in message
...
Im needing a code to round up not down
100.1 = needs to be 101
100.2 = needs to be 101
100.9 = needs to be 101








Sandy Mann

Rounding Up
 
Try something like:

If int(rs.Fields("SumOfRTL_QTY").Value / 10 ) < _
rs.Fields("SumOfRTL_QTY").Value / 10 then _
ThisWorkbook.Worksheets(1).Range(AD & i) = _
Int(rs.Fields("SumOfRTL_QTY").Value/10)+1
Else
ThisWorkbook.Worksheets(1).Range(AD & i) = _
rs.Fields("SumOfRTL_QTY").Value / 10


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Mike" wrote in message
...
In need it to be in vba this is what I have. If the sum of
rs.Fields("SumOfRTL_QTY").Value / 10 is a decimal just round up to the
next
Integer
ThisWorkbook.Worksheets(1).Range(AD & i) =
_rs.Fields("SumOfRTL_QTY").Value
/ 10

"Sandy Mann" wrote:

Check out the CEILING() function.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Mike" wrote in message
...
Im needing a code to round up not down
100.1 = needs to be 101
100.2 = needs to be 101
100.9 = needs to be 101










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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com