CLng

Function that converts an expression into a Long (Number) value.

Syntax
      CLng (expression)

Fractional values will be rounded to create a whole integer number, Tie-breaking: If the fraction is less than or equal to .5, the result will round down.
If the fraction is greater than .5, the result will round up.

CLng will throw an error if passed a Null value.

Examples

Dim lngDemo

lngDemo = CLng(35000.50)
>35000

PowerShell equivalent, converting a String to a Long:

$num = "11.64"
$num = [long] $num

“A man is like a fraction whose numerator is what he is and whose denominator is what he thinks of himself. The larger the denominator, the smaller the fraction” ~ Leo Tolstoy

Related:

CBool - Convert to boolean.
CByte
- Convert to byte.
CCur
- Convert to currency (number).
CDate
- Convert to Date.
CDbl
- Convert to Double (number).
CInt - Convert to Integer (number).
Convert to Base 36
Syntax - IsBlank function to detect Empty or NULL or Zero.


 
Copyright © 1999-2026 SS64.com
Some rights reserved