Table of contents
Collapse the table of content
Expand the table of content

^ Operator

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Used to raise a number to the power of an exponent. Syntaxresult=number^exponent The ^ operator syntax has these parts:

resultRequired; any numeric variable.
numberRequired; any numeric expression.
exponentRequired; any numeric expression.

Remarks A number can be negative only if exponent is an integer value. When more than one exponentiation is performed in a singleexpression, the ^ operator is evaluated as it is encountered from left to right. Usually, the data type of result is aDouble or aVariant containing a Double. However, if either number or exponent is aNull expression, result is Null.


This example uses the ^ operator to raise a number to the power of an exponent.

Dim MyValue
MyValue = 2 ^ 2    ' Returns 4.
MyValue = 3 ^ 3 ^ 3    ' Returns 19683.
MyValue = (-5) ^ 3    ' Returns -125.

© 2018 Microsoft