Truncating a cell value AFTER the decimal place

  • Thread starter Thread starter nano
  • Start date Start date
N

nano

I am assuming that the following question has a simple solution, howeve
I haven't found the answer after quickly searching the forum and a VB
book.

I would like to truncate the cell value in the following manner:

25.7873 to 25.787

My understanding of the truncate function is that it will truncate th
value to 25 and I have tried formatting the number with the following:

Selection.NumberFormat = "#.##0"

The NumberFormat only altered the displayed number, not the value o
the number. How can I easily accomplish this.

Thanks in advance,
Bruc
 
Nano,

Application.WorksheetFunction.Floor(25.7873, 0.001)

--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *
 
If you are always removing the last digit of the value:

Sub truncateLastDigit()
temp = ActiveCell.Value
ActiveCell.Value = Left(temp, Len(temp) - 1)
End Sub

I am assuming that the following question has a simple solution, however
I haven't found the answer after quickly searching the forum and a VBA
book.

I would like to truncate the cell value in the following manner:

25.7873 to 25.787

My understanding of the truncate function is that it will truncate the
value to 25 and I have tried formatting the number with the following:

Selection.NumberFormat = "#.##0"

The NumberFormat only altered the displayed number, not the value of
the number. How can I easily accomplish this.

Thanks in advance,
Bruce
 
To remove any decimal try this function

Function RndDown(dbInput As Double) As Intege
Dim strTemp As Strin

strTemp = CStr(dbInput
RndDown = Int(Left(strTemp, InStr(strTemp, ".") - 1)

End Functio

John H W
 
Back
Top