

{"id":96522,"date":"2021-06-22T09:00:04","date_gmt":"2021-06-22T03:30:04","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=96522"},"modified":"2021-06-07T12:58:17","modified_gmt":"2021-06-07T07:28:17","slug":"vba-arithmetic-operators","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/","title":{"rendered":"Arithmetic Operators &#8211; Visual Basic"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">VBA Arithmetic Operators perform operations such as adding, subtracting, multiplying and dividing the numbers. In these operations, we calculate the numeric values and they are represented by variables, functions, constants, property calls and other expressions.<\/span><\/p>\n<h3>VBA Arithmetic Operators<\/h3>\n<p><span style=\"font-weight: 400;\">Various VBA mathematical operators are:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Operation<\/b><\/td>\n<td><b>Operator<\/b><\/td>\n<td><b>Formula<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Addition<\/span><\/td>\n<td><span style=\"font-weight: 400;\">+<\/span><\/td>\n<td><span style=\"font-weight: 400;\">=5+3<\/span><\/p>\n<p><span style=\"font-weight: 400;\">=8<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Summing of two or more values.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Subtraction<\/span><\/td>\n<td><span style=\"font-weight: 400;\">&#8211;<\/span><\/td>\n<td><span style=\"font-weight: 400;\">=10-3<\/span><\/p>\n<p><span style=\"font-weight: 400;\">=7<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Subtracting the values.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Multiplication<\/span><\/td>\n<td><span style=\"font-weight: 400;\">*<\/span><\/td>\n<td><span style=\"font-weight: 400;\">=5*2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">=10<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Product of two values in the cells.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Division<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\/<\/span><\/td>\n<td><span style=\"font-weight: 400;\">=10\/2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">=5<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Dividing the value of a cell by another value in the cell.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Exponentiation<\/span><\/td>\n<td><span style=\"font-weight: 400;\">^<\/span><\/td>\n<td><span style=\"font-weight: 400;\">=2^3<\/span><\/p>\n<p><span style=\"font-weight: 400;\">=8<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Raising of the value by a power value.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Negation<\/span><\/td>\n<td><span style=\"font-weight: 400;\">~<\/span><\/td>\n<td><span style=\"font-weight: 400;\">a=2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">b=-a<\/span><\/p>\n<p><span style=\"font-weight: 400;\">b=-2<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Negation applies on one number and it uses the subtraction operator.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">Modulus<\/span><\/td>\n<td><span style=\"font-weight: 400;\">mod<\/span><\/td>\n<td><span style=\"font-weight: 400;\">=11mod2<\/span><\/p>\n<p><span style=\"font-weight: 400;\">=1<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Divides the\u00a0 number and returns the remainder.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>VBA Arithmetic Operators Example<\/h3>\n<p><span style=\"font-weight: 400;\">To perform arithmetic operations, follow the below steps:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">1: Open an excel workbook and save it as an excel macro-enabled workbook.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2: <\/span><b>\u00a0<\/b><span style=\"font-weight: 400;\">Add a button using macros.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In order to create a macro,\u00a0<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Go to the Developer tab and click on insert from the ribbon.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Choose the command button.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">Assign a macro by providing a name and click on the new button.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">3: Finally, press ok.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">4: Once the code window appears, type the following code.<\/span><\/p>\n<h3>1. Addition Operator in VBA<\/h3>\n<p><b>Example of VBA Addition Operator<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Addition_Click()\r\n  Dim a As Integer, b As Integer\r\n  a = 5\r\n  b = 5\r\n  MsgBox a+b, DataFlair, \"Addition Operator-DataFlair\"\r\nEnd Sub<\/pre>\n<p><span style=\"font-weight: 400;\">The user writes the code in the VBA editor.<\/span><\/p>\n<p><b>Code Explanation:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, Sub Addition_Click() is the sub procedure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2018a\u2019 and \u2018b\u2019 are integer data type variables. The addition operator sums the a value, b value and this results in 10 as output.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The result will appear in a message box with the \u2018Addition Operator &#8211; DataFlair\u2019 title.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">5: Click on save button or press ctrl+s.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">6: Close the vba code editor window.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Your GUI appears as follows:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96802\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button.png\" alt=\"Addition Operator in VBA\" width=\"1920\" height=\"992\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-300x155.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-1024x529.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-768x397.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-1536x794.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-720x372.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-520x269.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/add-button-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96837\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31.png\" alt=\"VBA Arithmetic Operator\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-1024x527.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/pasted-image-0-31-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>2. Subtraction Operator in VBA<\/h4>\n<p><b>Example of VBA Subtraction Operator<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Subtraction_Click()\r\n  Dim a As Integer, b As Integer\r\n  a = 5\r\n  b = 5\r\n  MsgBox a-b, DataFlair, \"Subtraction Operator-DataFlair\"\r\nEnd Sub\r\n<\/pre>\n<p><b>Code Explanation:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, Sub Subtraction_Click() is the sub procedure.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2018a\u2019 and \u2018b\u2019 are integer data type variables. The subtract operator subtracts the b value from a and this results in 0 as output.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The result will appear in a message box with the \u2018Subtraction Operator &#8211; DataFlair\u2019 title.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The user writes the code in the VBA editor. <\/span><span style=\"font-weight: 400;\">Your GUI appears as below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96803\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui.png\" alt=\"subtraction gui\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-1024x527.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-gui-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96804\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1.png\" alt=\"Subtraction Operator in VBA\" width=\"1920\" height=\"1000\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-300x156.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-1024x533.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-768x400.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-1536x800.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-720x375.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-520x271.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/subtraction-code1-320x167.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>3. Multiplication Operator in VBA<\/h4>\n<p><b>Example of VBA Multiplication Operator<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Sub Product_Click()<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Product_Click()\r\n  Dim a As Integer, b As Integer\r\n  a = 5\r\n  b = 5\r\n  MsgBox a*b, DataFlair, \"Product Operator-DataFlair\"\r\nEnd Sub<\/pre>\n<p><b>Code Explanation:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, Sub Product_Click() is the sub procedure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2018a\u2019 and \u2018b\u2019 are integer data type variables. Here, the output will be 25 as the a value is 5 and b value is 5. The product of a * b = 25.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The result will appear in a message box with the \u2018Product Operator-DataFlair\u2019 title.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The user writes the code in the VBA editor. <\/span><span style=\"font-weight: 400;\">Your GUI appears as below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96805\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI.png\" alt=\"product GUI\" width=\"1920\" height=\"992\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-300x155.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-1024x529.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-768x397.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-1536x794.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-720x372.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-520x269.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-GUI-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96806\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op.png\" alt=\"Multiplication Operator in VBA\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-1024x527.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/product-op-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>4. Division Operator in VBA<\/h4>\n<p><strong>Example of VBA Division Operator<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Division_Click()\r\n  Dim a As Integer, b As Integer\r\n  a = 5\r\n  b = 5\r\n  MsgBox a\/b, DataFlair, \"Division Operator-DataFlair\"\r\nEnd Sub<\/pre>\n<p><b>Code Explanation:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, Sub Division_Click() is the sub procedure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2018a\u2019 and \u2018b\u2019 are integer data type variables. The a value divides by b value and results the output i.e., (5\/5 =1)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The result will appear in a message box with the \u2018Division Operator &#8211; DataFlair\u2019 title.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The user writes the code in the VBA editor. GUI Appears as below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96807\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI.png\" alt=\"Division Operator in VBA\" width=\"1920\" height=\"992\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-300x155.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-1024x529.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-768x397.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-1536x794.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-720x372.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-520x269.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/DIV-GUI-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96808\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op.png\" alt=\"VBA Division Operator\" width=\"1920\" height=\"1032\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-1024x550.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-150x81.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-768x413.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-1536x826.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-720x387.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-520x280.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/div-op-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>5. Modulus Operator in VBA<\/h4>\n<p><b>Example of VBA Modulus Operator<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Modulus_Click()\r\n  Dim a As Integer, b As Integer\r\n  a = 13\r\n  b = 5\r\n  MsgBox a mod b, DataFlair, \"Modulus Operator-DataFlair\"\r\nEnd Sub<\/pre>\n<p><b>Code Explanation:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, Sub Modulus_Click() is the sub procedure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2018a\u2019 and \u2018b\u2019 are integer data type variables. The output results in 3 because the reminder that the user would get after dividing 13\/ 5 is 3.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The result will appear in a message box with the \u2018Modulus Operator &#8211; DataFlair\u2019 title.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The user writes the code in the VBA editor. <\/span><span style=\"font-weight: 400;\">Your GUI appears as below:<br \/>\n<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96809\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI.png\" alt=\"MOD GUI\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-1024x527.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/MOD-GUI-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96810\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op.png\" alt=\"modulus operator in VBA\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-1024x527.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/modulus-op-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>6. Exponentiation Operator in VBA<\/h4>\n<p><b>Example of VBA Exponentiation Operator<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Exponent_Click()\r\n  Dim a As Integer, b As Integer\r\n  a = 5\r\n  b = 5\r\n  MsgBox a ^ b, DataFlair, \"Exponentiation Operator-DataFlair\"\r\nEnd Sub<\/pre>\n<p><b>Code Explanation:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, Sub Exponent_Click() is the sub procedure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2018a\u2019 and \u2018b\u2019 are integer data type variables. The value of a is raised by the power of value b i.e., 5 ^ 5 = 3125.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The result will appear in a message box with the \u2018Exponentiation Operator &#8211; DataFlair\u2019 title.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The user writes the code in the VBA editor. <\/span><span style=\"font-weight: 400;\">Your GUI appears as below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96811\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI.png\" alt=\"Exponent GUI\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-1024x527.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/EXPOnent-GUI-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96812\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation.png\" alt=\"exponentiation Output\" width=\"1920\" height=\"992\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-300x155.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-1024x529.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-768x397.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-1536x794.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-720x372.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-520x269.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/exponentiation-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>7. Negation Operator in VBA<\/h4>\n<p><b>Example of VBA Negation Operator<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Negation_Click()\r\n  Dim a As Integer, b As Integer\r\n  a = 5\r\n  b = -a\r\n  MsgBox b, DataFlair, \"Negation Operator-DataFlair\"\r\nEnd Sub<\/pre>\n<p><b>Code Explanation:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Here, Sub Negation_Click() is the sub procedure.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2018a\u2019 and \u2018b\u2019 are integer data type variables. The b variable will hold the negation value of a i.e., &#8211; 5 here.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The result will appear in a message box with the \u2018Negation Operator &#8211; DataFlair\u2019 title.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The user writes the code in the VBA editor. <\/span><span style=\"font-weight: 400;\">Your GUI appears as below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96813\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI.png\" alt=\"negation GUI\" width=\"1920\" height=\"988\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-300x154.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-1024x527.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-150x77.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-768x395.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-1536x790.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-720x371.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-520x268.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-GUI-320x165.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96814\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op.png\" alt=\"negation op\" width=\"1920\" height=\"996\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-300x156.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-1024x531.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-150x78.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-768x398.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-1536x797.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-720x374.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-520x270.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/negation-op-320x166.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>Calculation Order in VBA<\/h3>\n<p><span style=\"font-weight: 400;\">There are few calculations priority while performing the calculations in Excel sets. The priority order as follows:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">1. Multiplications, Divisions, Exponentiation<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. Modulus<\/span><\/p>\n<p><span style=\"font-weight: 400;\">3. Addition and Subtraction<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The performance of the operations takes place from Left to Right following the calculation property. Let\u2019s look at a sample:<\/span><\/p>\n<p><b>Example of the order of calculation in VBA<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Sub Initialize()\r\nDim calc As Integer\r\ncalc = 5 + 5 * 2 \/ 5\r\nMsgBox calc\r\nEnd Sub<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96816\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op.png\" alt=\"Calculation Order in VBA\" width=\"1559\" height=\"465\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op.png 1559w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-300x89.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-1024x305.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-150x45.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-768x229.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-1536x458.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-720x215.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-520x155.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/calc-op-320x95.png 320w\" sizes=\"auto, (max-width: 1559px) 100vw, 1559px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">In this case 5+5*2\/5, excel calculates the 5*2 first, followed by the 10\/5 and only then the 5+2, resulting in 7.\u00a0<\/span><\/p>\n<p><b>Note: <\/b><span style=\"font-weight: 400;\">The variable assigns the value from right to left and the operation usually occurs from left to right.\u00a0<\/span><\/p>\n<h3>Bit-Shift Operation in VBA<\/h3>\n<p><span style=\"font-weight: 400;\">Performing an arithmetic shift on a bit pattern is known as bit-shift operation. Operand on the left holds the pattern and the operand on the right tells about the number of positions to be shifted in the pattern. There is no overflow exception in arithmetic shifts. You can shift the pattern to the right using &gt;&gt; operator and to the left using &lt;&lt; operator.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The data type of the pattern operand is Byte, Signed Byte, Short, Unsigned Short, Integer, Unsigned Integer, Long or Unsigned Long<\/span><b>.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Arithmetic shifts are not circular, which means the shifting of bits at one side does not reflect on the other side. The positions of the bit by a shift are as follows:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">1. 0 for the arithmetic left shift.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. 0 for the arithmetic right shift of a positive number, unsigned data type (byte, unsigned short, unsigned integer, unsigned long)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">3. 1 for the arithmetic right shift of the negative number (Signed Byte, Integer, Short or Long).<\/span><\/p>\n<h3>Summary<\/h3>\n<p><span style=\"font-weight: 400;\">1. Visual Basic Applications can also perform arithmetic calculations using arithmetic operators.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. The user can also write user &#8211; defined functions utilizing the arithmetic operators.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>VBA Arithmetic Operators perform operations such as adding, subtracting, multiplying and dividing the numbers. In these operations, we calculate the numeric values and they are represented by variables, functions, constants, property calls and other&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":96800,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24129],"tags":[24544,24542,24546,24543,24545],"class_list":["post-96522","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ms-excel","tag-addition-operator-in-vba","tag-arithmetic-operators-in-vba","tag-multiplication-operator-in-vba","tag-negation-operator-in-vba","tag-subtraction-operator-in-vba"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Arithmetic Operators - Visual Basic - DataFlair<\/title>\n<meta name=\"description\" content=\"VBA Arithmetic Operators perform operations such as adding, subtracting, multiplying and dividing numbers. Learn more about these operators.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Arithmetic Operators - Visual Basic - DataFlair\" \/>\n<meta property=\"og:description\" content=\"VBA Arithmetic Operators perform operations such as adding, subtracting, multiplying and dividing numbers. Learn more about these operators.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-22T03:30:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-Arithmetic-Operators-Multiplication-Division-Addition.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Arithmetic Operators - Visual Basic - DataFlair","description":"VBA Arithmetic Operators perform operations such as adding, subtracting, multiplying and dividing numbers. Learn more about these operators.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/","og_locale":"en_US","og_type":"article","og_title":"Arithmetic Operators - Visual Basic - DataFlair","og_description":"VBA Arithmetic Operators perform operations such as adding, subtracting, multiplying and dividing numbers. Learn more about these operators.","og_url":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-06-22T03:30:04+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-Arithmetic-Operators-Multiplication-Division-Addition.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"Arithmetic Operators &#8211; Visual Basic","datePublished":"2021-06-22T03:30:04+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/"},"wordCount":996,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-Arithmetic-Operators-Multiplication-Division-Addition.jpg","keywords":["Addition Operator in VBA","Arithmetic Operators in VBA","Multiplication Operator in VBA","Negation Operator in VBA","Subtraction Operator in VBA"],"articleSection":["MS Excel Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/","url":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/","name":"Arithmetic Operators - Visual Basic - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-Arithmetic-Operators-Multiplication-Division-Addition.jpg","datePublished":"2021-06-22T03:30:04+00:00","description":"VBA Arithmetic Operators perform operations such as adding, subtracting, multiplying and dividing numbers. Learn more about these operators.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-Arithmetic-Operators-Multiplication-Division-Addition.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-Arithmetic-Operators-Multiplication-Division-Addition.jpg","width":1200,"height":628,"caption":"VBA Arithmetic Operators"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/vba-arithmetic-operators\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"MS Excel Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/ms-excel\/"},{"@type":"ListItem","position":3,"name":"Arithmetic Operators &#8211; Visual Basic"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c322416204232f4dd97ef3901b0a499a5d34d7ba7fe333f4bfe53a907873d293?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team specializes in creating clear, actionable content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Backed by industry expertise, we make learning easy and career-oriented for beginners and pros alike.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam3\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96522","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=96522"}],"version-history":[{"count":7,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96522\/revisions"}],"predecessor-version":[{"id":96838,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96522\/revisions\/96838"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/96800"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=96522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=96522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=96522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}