Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal/Whole # Question 1

Status
Not open for further replies.

quietstormtw

Programmer
Sep 16, 2002
81
US
Hi all,

I've looked for 2 days now for something that I can use...but I'm running out of time here.

I have a calculation which gives me some results, wherein, I need to massage the data to have it formatted in a distinct format.

Calculation:

494,570.49
* .60
* .75

Answer
222,556.72

I was wondering if the was any way to strip the decimal from the answer, leaving the value of 22255672?

Thanks in advance for any assistance!
 
Something like this ?
Int(100 * 494570.49 * .60 * .75)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Try [tt]CLng()[/tt] function

________________________________________________________
Zameer Abdulla
Help to find Missing people
All cats love fish but fear to wet their paws..
 
Must be the stress of the EOY processing ô¿ô Multipy by 100 to remove the decimal points. My 5th grade teacher would be upset...

Thanks PHV - you've saved my life again!!

Thanks Zameer
 
hmmmmmmmmmmmmmmmmmmm ... mmmmmmmmmmmmmmmmmmmm but what about other calcs, which may have other numbers of 'decimial digits'?



MichaelRed


 
Not sure when you would use this, but this may be more generic
Code:
Public Function fncMoveDecimal(ByVal dblVal As Double) As Double
  Dim intDecimals As Integer
  If InStr(dblVal, ".") = 0 Then
    intDecimals = 0
  Else
    intDecimals = Len(dblVal & "") - InStr(dblVal, ".")
   End If
     fncMoveDecimal = (10 ^ intDecimals) * dblVal
End Function
123.45 > 12345
123.00001 > 12300001
123 > 123
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top