

{"id":96520,"date":"2021-06-26T09:00:53","date_gmt":"2021-06-26T03:30:53","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=96520"},"modified":"2021-06-07T18:02:23","modified_gmt":"2021-06-07T12:32:23","slug":"vba-logical-operators-and-or-not-xor","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/","title":{"rendered":"VBA Logical Operators &#8211; AND, OR, NOT, XOR"},"content":{"rendered":"<p>Visual Basic for Applications is basically called VBA, which is an event-driven programming language from Microsoft. VBA is used with MS Office applications like MS-Excel. These logical operators are basically used to combine more than one condition. Here, we will discuss the logical operators such as AND, OR, XOR and NOT in VBA.<\/p>\n<h3>Developer Options in VBA<\/h3>\n<p><strong>Step 1:<\/strong><\/p>\n<p>To get the Developer Options tab, first we need to right click on the Home, click on the Customize the Ribbon button and that leads to a Dialog Box.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96906\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1.png\" alt=\"Developer Options in VBA\" width=\"1920\" height=\"1032\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-1024x550.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-150x81.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-768x413.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-1536x826.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-720x387.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-520x280.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s1-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4><strong>Step 2:<\/strong><\/h4>\n<p>From the Customize the Ribbon tab, check the Developer Options to enable the Developer tab and then click Ok.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96907\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2.png\" alt=\"VBA Developer Options\" width=\"1920\" height=\"1032\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-1024x550.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-150x81.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-768x413.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-1536x826.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-720x387.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-520x280.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s2-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4><strong>Step 3<\/strong>:<\/h4>\n<p>Here, you find the Developer tab being enabled. In the Insert Option in the Developer tab, click the Command Button, so that it gets enabled.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96908\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3.png\" alt=\"VBA Developer Options\" width=\"1069\" height=\"177\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3.png 1069w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3-300x50.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3-1024x170.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3-150x25.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3-768x127.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3-720x119.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3-520x86.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s3-320x53.png 320w\" sizes=\"auto, (max-width: 1069px) 100vw, 1069px\" \/><\/a><\/p>\n<h4><strong>Step 4:<\/strong><\/h4>\n<p>Right-click on the Command Button and click View Code, so that it leads to the coding environment.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96909\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4.png\" alt=\"VBA Developer Options\" width=\"1920\" height=\"1032\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-1024x550.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-150x81.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-768x413.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-1536x826.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-720x387.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-520x280.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/dev_s4-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>Logical AND Operator in VBA<\/h3>\n<p>The Logical AND operator condition applies if all the given conditions are True. If it occurs as such, the value will be evaluated to True, else, if any of the given conditions is False, it is False.<\/p>\n<p><strong>Example of VBA Logical AND Operator<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub CommandButton1_Click()\r\nDim s1 As Integer, s2 As Integer, result As String\r\ns1 = Range(\"A1\").Value\r\ns2 = Range(\"B1\").Value\r\nIf s1 &gt;= 60 And s2 &gt; 1 Then\r\n    result = \"pass\"\r\nElse\r\n    result = \"fail\"\r\nEnd If\r\nRange(\"C1\").Value = result\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>Here, s1, s2 are the variables and now we are going to check whether the s1 variable value is greater than or equal to 60 and the s2 variable value is greater than 1. If these two conditions satisfy then the result outputs as true or even if one condition fails, the output results as false. The output appears in the C1 cell.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/and_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96910\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/and_2.png\" alt=\"VBA Logical AND Operator\" width=\"680\" height=\"128\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/and_2.png 680w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/and_2-300x56.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/and_2-150x28.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/and_2-520x98.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/and_2-320x60.png 320w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/a><\/p>\n<p>Since both the conditions satisfy, the result appears as pass.<\/p>\n<h3>Logical OR Operator in VBA<\/h3>\n<p>The Logical OR operator condition applies if any one of the given conditions is True, then value will be evaluated to True, else, if all of the given conditions is False, then it will be evaluated to False.<\/p>\n<p><strong>Example of VBA Logical OR Operator<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub CommandButton1_Click()\r\nDim s1 As Integer, s2 As Integer, result As String\r\n\r\ns1 = Range(\"A1\").Value\r\ns2 = Range(\"B1\").Value\r\n\r\nIf s1 &gt;= 60 Or s2 &gt; 1 Then\r\n    result = \"pass\"\r\nElse\r\n    result = \"fail\"\r\nEnd If\r\n\r\nRange(\"C1\").Value = result\r\n\r\nEnd Sub<\/pre>\n<p><strong>Code Explanation<\/strong><\/p>\n<p>Here, s1, s2 are the variables and now we are going to check whether the s1 variable value is greater than or equal to 60 or the s2 variable value is greater than 1. If any of these conditions satisfy then the result outputs as true or if both the conditions fail, the output results as false. The output appears in the C1 cell.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/or_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96911\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/or_2.png\" alt=\"VBA Logical OR Operator\" width=\"681\" height=\"154\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/or_2.png 681w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/or_2-300x68.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/or_2-150x34.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/or_2-520x118.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/or_2-320x72.png 320w\" sizes=\"auto, (max-width: 681px) 100vw, 681px\" \/><\/a><\/p>\n<p>Since both the conditions are not satisfied, the result appears as fail.<\/p>\n<h3>Logical NOT Operator in VBA<\/h3>\n<p>The Logical NOT operator condition is one which works as an Inverse Function. If the given condition is True, then it returns False and if the given condition is False, it returns True.<\/p>\n<p><strong>Example of VBA Logical NOT Operator<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub CommandButton1_Click()\r\nDim s1 As Integer, s2 As Integer, result As String\r\n\r\ns1 = Range(\"A1\").Value\r\ns2 = Range(\"B1\").Value\r\n\r\nIf s1 &gt;= 60 And Not s2 &gt; 1 Then\r\n    result = \"pass\"\r\nElse\r\n    result = \"fail\"\r\nEnd If\r\n\r\nRange(\"C1\").Value = result\r\n\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation:<\/strong><\/p>\n<p>Here, s1, s2 are the variables and now we are going to check whether the s1 variable value is not greater than or equal to 60 or the s2 variable value is not greater than 1. If any of these conditions satisfy then the result outputs as false or if both the conditions fail, the output results as true. The output appears in the C1 cell.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/not_2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96912\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/not_2.png\" alt=\"VBA Logical NOT Operator\" width=\"682\" height=\"146\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/not_2.png 682w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/not_2-300x64.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/not_2-150x32.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/not_2-520x111.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/not_2-320x69.png 320w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/a><\/p>\n<p>Since both the conditions fail, the result appears as pass.<\/p>\n<h3>Logical XOR Operator in VBA<\/h3>\n<p>The Logical XOR operator is the combination of NOT and OR logical operators. It is also called logical exclusion. This operator results true only if one of the conditions evaluates to be true or else it returns false.<\/p>\n<p><strong>Example of VBA Logical XOR Operator<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Private Sub CommandButton1_Click()\r\nDim s1 As Integer, s2 As Integer, result As String\r\n\r\ns1 = 100\r\ns2 = 50\r\n\r\nIf (s1 &lt;&gt; 0 Xor s2 &lt;&gt; 0) Then\r\n      MsgBox (\"The test condition passes\")\r\n   Else\r\n      MsgBox (\"The test condition fails\")\r\n   End If\r\nEnd Sub\r\n<\/pre>\n<p><strong>Code Explanation<\/strong><\/p>\n<p>Here, s1, s2 are the integer data type variables and now we are going to check whether the s1 variable value or either the s2 variable value is equal to 0. If any of these conditions satisfy then the result output as \u201cThe test condition passes\u201d or else it returns \u201cThe test condition fails\u201d. The output appears in the message box.<\/p>\n<p><strong>Output<\/strong><\/p>\n<p>Since both the conditions fail, the result appears as \u201cThe test condition fails\u201d.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-96913\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op.png\" alt=\"VBA Logical XOR Operator\" width=\"1156\" height=\"505\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op.png 1156w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op-300x131.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op-1024x447.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op-150x66.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op-768x336.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op-720x315.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op-520x227.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/xor-op-320x140.png 320w\" sizes=\"auto, (max-width: 1156px) 100vw, 1156px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>From this, we have got to know about the Logical Operators AND, OR, XOR and NOT operators in Visual Basic for Applications(VBA) in MS Excel. The steps for coding in VBA along with the code has been explained.<\/p>\n<p>The initial step is to enable the Developer tab and click on the Command Button, view the Code by right clicking on it and then after coding, we can obtain the final result by clicking on the button in the spreadsheet.<\/p>\n<p>The utilization of logical functions in VBA will help the user to understand and analyze the data. It&#8217;s widely used for decision-making purposes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visual Basic for Applications is basically called VBA, which is an event-driven programming language from Microsoft. VBA is used with MS Office applications like MS-Excel. These logical operators are basically used to combine more&#46;&#46;&#46;<\/p>\n","protected":false},"author":7,"featured_media":96914,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24129],"tags":[24555,24558,24554,24556,24557],"class_list":["post-96520","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ms-excel","tag-vba-logical-and-operator","tag-vba-logical-not-operator","tag-vba-logical-operators","tag-vba-logical-or-operator","tag-vba-logical-xor-operator"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>VBA Logical Operators - AND, OR, NOT, XOR - DataFlair<\/title>\n<meta name=\"description\" content=\"Logical operators are used to evaluate more than one condition. Excel VBA Logical Operators include AND, OR, NOT. Learn more about these.\" \/>\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-logical-operators-and-or-not-xor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VBA Logical Operators - AND, OR, NOT, XOR - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Logical operators are used to evaluate more than one condition. Excel VBA Logical Operators include AND, OR, NOT. Learn more about these.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/\" \/>\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-26T03:30:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-LOGICAL-OPERATORS.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=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"VBA Logical Operators - AND, OR, NOT, XOR - DataFlair","description":"Logical operators are used to evaluate more than one condition. Excel VBA Logical Operators include AND, OR, NOT. Learn more about these.","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-logical-operators-and-or-not-xor\/","og_locale":"en_US","og_type":"article","og_title":"VBA Logical Operators - AND, OR, NOT, XOR - DataFlair","og_description":"Logical operators are used to evaluate more than one condition. Excel VBA Logical Operators include AND, OR, NOT. Learn more about these.","og_url":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-06-26T03:30:53+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-LOGICAL-OPERATORS.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/beb0cab24b7aa54423a3b50e669a9dcd"},"headline":"VBA Logical Operators &#8211; AND, OR, NOT, XOR","datePublished":"2021-06-26T03:30:53+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/"},"wordCount":758,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-LOGICAL-OPERATORS.jpg","keywords":["VBA Logical AND Operator","VBA Logical NOT Operator","VBA Logical Operators","VBA Logical OR Operator","VBA Logical XOR Operator"],"articleSection":["MS Excel Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/","url":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/","name":"VBA Logical Operators - AND, OR, NOT, XOR - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-LOGICAL-OPERATORS.jpg","datePublished":"2021-06-26T03:30:53+00:00","description":"Logical operators are used to evaluate more than one condition. Excel VBA Logical Operators include AND, OR, NOT. Learn more about these.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-LOGICAL-OPERATORS.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/06\/VBA-LOGICAL-OPERATORS.jpg","width":1200,"height":628},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/vba-logical-operators-and-or-not-xor\/#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":"VBA Logical Operators &#8211; AND, OR, NOT, XOR"}]},{"@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\/96520","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=96520"}],"version-history":[{"count":3,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96520\/revisions"}],"predecessor-version":[{"id":96915,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/96520\/revisions\/96915"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/96914"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=96520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=96520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=96520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}