Arithmetical (Math) Operators
- Last UpdatedJul 18, 2023
- 1 minute read
VBA arithmetic operators are used in VBA statements to mathematically manipulate numeric variables and numbers. The resultant is often assigned to a third variable using the assignment operator.
The arithmetic operation as determined by the arithmetic operator is performed between the values of the operands (variables or numbers positioned immediately on either side of the arithmetic operator).
|
Operator |
Function |
Usage |
|---|---|---|
|
^ |
Exponentiation |
X = Y ^ 2 |
|
- |
Negation |
X = - 2 |
|
* |
Multiplication |
X = 2 * 3 |
|
/ |
Division |
X = 10 / 2 |
|
Mod |
Modulo |
X = Y MOD Z |
|
+ |
Addition |
X = 2 + 3 |
|
- |
Addition |
X = 6 - 4 |