Rounding Up

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

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
 
Check out the CEILING() function.

--
HTH

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

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
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
 
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
 
ThisWorkbook.Worksheets(1).Range(AD & i) =
Application.Ceiling(_rs.Fields("SumOfRTL_QTY").Value / 10,1)


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
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

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top