rounding down

Ce 21 Reputation points
2022-01-05T21:53:56.837+00:00

hello all,
i want to round numbers down with excell VBA. For example, if number is 4.88, result must be 4.
how can i do that?
thanks

Developer technologies | Visual Basic for Applications
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 122.6K Reputation points
    2022-01-06T09:01:16.767+00:00

    Check an example:

    Dim x As Double
    x = 4.88
    
    Dim result As Integer
    result = WorksheetFunction.Floor(x, 1) ' result: 4
    

    See also the Floor_Math and Floor_Precise functions in documentation.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.