CINT(expression)

Returns the expression converted to an integer data type (Integer).


expressionThe expression to evaluate and convert to an integer.

REMARKS
* The Integer data type is a Value data type.
* The "expression" can be any value between -32,768 and 32,767.
* If "expression" is outside the range of the data type being converted to, an error occurs.
* If "expression" includes any fractions or decimals these are rounded.
* Any fractional parts less than or equal to 0.5 are rounded down to the nearest even number.
* Any fractional parts greater than 0.5 are rounded up.
* VBAs hexadecimal notation symbol is "&H"
* You can use the CDBL to return an expression converted to a double data type.
* You can use the CLNG to return an expression converted to a long data type.
* You can use the CSNG to return an expression converted to a single data type.
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print CInt(-1.1) = -2 
Debug.Print CInt(-1.9) = -2
Debug.Print CInt(0.2) = 0
Debug.Print CInt(0.5) = 0
Debug.Print CInt(0.6) = 1
Debug.Print CInt(0.9) = 1
Debug.Print CInt(1.1) = 1
Debug.Print CInt(1.5) = 2
Debug.Print CInt(2.5) = 2
Debug.Print CInt(2.6) = 3
Debug.Print CInt(11.5) = 12
Debug.Print CInt(12.5) = 12
Debug.Print CInt(12.6) = 13
Debug.Print CInt(12.9) = 13
Debug.Print CInt("&H75FF") = 30207
Debug.Print CInt("&H754") = 1876

Dim lPrice As Long
lPrice = 12.75
Debug.Print TypeName(CInt(lPrice)) '= "Integer"

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top