Arithmetic Operators are the operators which perform mathematical operation or which perform any operation between two numbers like addition(+), subtraction(-), multiplication(*), division( / ), exponentiation(^), modulus(Mod), Bit-Shift operations. In this article, we will learn about the excel VBA arithmetic operators in detail.
Addition Operator (+)
The Addition operator is used to add numbers. We use the (+)plus operator as a symbol for addition. For example, if we want to add 12 and 14 to get 26, then we will use the (+)plus operator. Declare a variable x, and now, write x = 12 + 14, hence, x stores 26 in it.
Subtraction Operator (-)
The Subtraction operator is used to find the difference between two numbers. We use the (-)minus operator as a symbol for subtraction. For example, if we want to subtract 14 and 12 to get 2, then we will use the (-)minus operator. Declare a variable x, and now, write x = 14 – 12, hence, x stores 2 in it.
Multiplication Operator (*)
The Multiplication operator is used to multiply numbers. We use the (*)asterisk operator as a symbol for multiplication. For example, if we want to multiply 4 and 2 to get 8, then we will use the (*)asterisk operator. Declare a variable x, and now, write x = 4 * 2, hence, x stores 8 in it.
Division Operator (/)
The Division operator is used to divide numbers. We use the (/)forward slash operator as a symbol for division. For example, if we want to divide 40 and 20 to get 2, then we will use the (/)forward slash operator. Declare a variable x, and now, write x = 40 / 20, hence, x stores 2 in it.
Exponentiation Operator (^)
The Exponentiation operator is used to get the power of a number. We use the (^)caret operator as a symbol for exponentiation. For example, if we want to exponent 20 with 2 to get 400, then we will use the (^)caret operator. Declare a variable x, and now, write x = 20 ^ 2, hence, x stores 400 in it.
Modulus Operator (Mod)
The Mod operator is used to find the remainder of two numbers. We can write Mod itself, for finding the mod of two numbers. For example, if we find mod of 94 and 6 we get 4. Declare a variable x, and now, write x = 94 Mod 6, hence, x stores 2 in it.
Bit-Shift Operations
The Bit-Shift operators are (<<) left-shift operator and (>>) right-shift operator. The left-shift operator, shifts bits to the left, a number of times, as mentioned. For example, num << 4, shifts the bits of number num, 4 times. Similarly, the right-shift operator, shifts bits to the right, a number of times, as mentioned. For example, num >> 2, shifts the bits of number num, 2 times.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!
Looking for a place to share your ideas, learn, and connect? Our Community portal is just the spot! Come join us and see what all the buzz is about!
Last Updated :
16 Oct, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...