|
-
Jan 31st, 2008, 08:18 AM
#1
Thread Starter
Hyperactive Member
Rounding off differently, how I can it make........
Hi All
someone know how i can to round my values however when they have already value after comma larger from 0,2.
e.g.
normally rounded off : 5,44 to 5,00 | 6,67 to 7,00 | 1,53 to 2 etc, etc
I want to make: 2,23 to 3,00 | 5,17 to 5,00 | 1,28 to 2,00 etc, etc
hope, that this comprehensible what I want
So, how it make? thanks in advance
I know, I know, my English is bad, sorry .....
-
Jan 31st, 2008, 08:32 AM
#2
Addicted Member
Re: Rounding off differently, how I can it make........
vb Code:
Public Function roundDown(dblValue As Double) As Double
On Error GoTo PROC_ERR
Dim myDec As Long
myDec = InStr(1, CStr(dblValue), ".", vbTextCompare)
If myDec > 0 Then
roundDown = CDbl(Left(CStr(dblValue), myDec))
Else
roundDown = dblValue
End If
PROC_EXIT:
Exit Function
PROC_ERR:
MsgBox Err.Description, vbInformation, "Round Down"
End Function
Public Function roundUp(dblValue As Double) As Double
On Error GoTo PROC_ERR
Dim myDec As Long
myDec = InStr(1, CStr(dblValue), ".", vbTextCompare)
If myDec > 0 Then
roundUp = CDbl(Left(CStr(dblValue), myDec)) + 1
Else
roundUp = dblValue
End If
PROC_EXIT:
Exit Function
PROC_ERR:
MsgBox Err.Description, vbInformation, "Round Up"
End Function
Regards
Srinivasan Baskaran
India
-
Jan 31st, 2008, 08:47 AM
#3
Re: Rounding off differently, how I can it make........
How about this:
dblValue=dblValue + 0.3
Round as normal
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|