{"id":31704,"date":"2021-02-22T11:23:11","date_gmt":"2021-02-22T10:23:11","guid":{"rendered":"https:\/\/blog.sheetgo.com\/?p=31704"},"modified":"2021-02-22T11:23:11","modified_gmt":"2021-02-22T10:23:11","slug":"se-e-excel","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/pt\/blog\/excel-functions\/if-and-excel\/","title":{"rendered":"Como usar a combina\u00e7\u00e3o de fun\u00e7\u00f5es IF AND no Excel"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>The <a href=\"https:\/\/support.microsoft.com\/en-us\/office\/if-function-69aed7c9-4e8a-4755-a9bc-aa8bbff73be2\" target=\"_blank\" rel=\"noopener noreferrer\">IF function<\/a> in Excel is extremely useful: it generates different outcomes depending on whether the input meets a certain criteria. But what if you want the input to meet multiple criteria instead of just one? That\u2019s where the <a href=\"https:\/\/support.microsoft.com\/en-us\/office\/and-function-5f19b2e8-e1df-4408-897a-ce285a19e9d9\" target=\"_blank\" rel=\"noopener noreferrer\">AND function<\/a> comes in. When combined, the IF AND Excel functions create an even more powerful tool!<\/p>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3>Syntax<\/h3>\n<p>I\u2019ll start off by showing the syntax of a typical <a href=\"https:\/\/www.sheetgo.com\/blog\/excel-functions\/if-function-excel\/\">IF function<\/a>:<\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.16&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]=IF(logical_test, value_if_true, [value_if_false])[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<ul>\n<li><b>logical_expression<\/b> \u2013 an expression or reference to a cell containing an expression that has a logical value such as TRUE or FALSE. The AND function is used here to test multiple expressions<\/li>\n<li><b>value_if_true<\/b> \u2013 the value that the function returns if the logical_expression is TRUE. This can be a number, text, or even another function that returns a value. You can also embed another IF statement in here: this is known as a nested IF<\/li>\n<li><b>value_if_false<\/b> \u2013 the value that the IF function returns if the logical_expression is FALSE. Similar to the value_if_true, this can be a number, text or another function that returns a value. It can also be a nested IF. Note that this is an optional input and if you leave it out you will get a blank value when the expression is FALSE<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Now for the AND function:<\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.16&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]=AND(logical1, [logical2], &#8230;)[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<ul>\n<li><b>logical1, logical2, etc.<\/b> are logical expressions. The function will generate a TRUE result only if all the logical expressions are true<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Finally, when you put them together you get:<\/p>\n<p>[\/et_pb_text][et_pb_text module_class=&#8221;spreadsheet-function&#8221; _builder_version=&#8221;4.16&#8243; border_width_left=&#8221;4px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]=IF(AND(logical1, [logical2], &#8230;), value_if_true, [value_if_false])[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<ul>\n<li>When combined, the AND function takes the place of the logical_expression parameter in the IF function<\/li>\n<li>All the logical expressions in the AND function must be TRUE in order to get the <b>value_if_true<\/b><\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3>How to use the IF AND combination<\/h3>\n<p>I\u2019ll show a couple examples now in order to fully explain the functions. In this example, I have a list of people and their dietary information. I want to write a function that will tell me whether each person is a vegetarian <i>and<\/i> has allergies.<\/p>\n<p>I can do this with the formula <b>=IF(AND(D2=&#8221;Yes&#8221;,E2=&#8221;Yes&#8221;),&#8221;Yes&#8221;,&#8221;No&#8221;)<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/1.-IF-AND-example.png&#8221; alt=&#8221;if and excel 1&#8243; title_text=&#8221;1. IF AND example&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; width=&#8221;640px&#8221; max_width=&#8221;640px&#8221; height=&#8221;440px&#8221; max_height=&#8221;440px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>The logical expression here is <b>AND(D2=&#8221;Yes&#8221;,E2=&#8221;Yes\u201d)<\/b>. This expression only evaluates as TRUE when both the values in column D (vegetarian) <i>and<\/i> E (allergies) are Yes. If either of them are No, then the expression is FALSE.<\/p>\n<p>Note that you can use any of the logical operators in your logical expression. The list below shows the options you have.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/2.-Logical-Operators.png&#8221; alt=&#8221;if and excel logical operators 2&#8243; title_text=&#8221;2. Logical Operators&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; width=&#8221;640px&#8221; max_width=&#8221;640px&#8221; height=&#8221;440px&#8221; max_height=&#8221;440px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h4>Number between two values<\/h4>\n<p>Another way you can use the IF AND Excel function combination is when you want to find a number that\u2019s between two numbers.<\/p>\n<p>For example, if I want to see who is older than 19 but younger than 22, I can use the function <b>=IF(AND(B2>19,B2<22),\"Yes\",\"No\")<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/3.-IF-AND-between-two-values.png&#8221; alt=&#8221;if and excel between two values 3&#8243; title_text=&#8221;3. IF AND between two values&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; width=&#8221;640px&#8221; max_width=&#8221;640px&#8221; height=&#8221;440px&#8221; max_height=&#8221;440px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Here I\u2019ve used two more of the logical operators shown previously (> and <). Using the AND function allows me to quickly set a range for each value by defining the upper and lower limits.<\/p>\n<p>I could also use the >= and <= operators to get the same result, by typing <b>=IF(AND(B2>=20,B2<=21),\"Yes\",\"No\")<\/b>.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/02\/4.-IF-AND-greater-than_equal-to.png&#8221; alt=&#8221;if and excel greater than equal to 4&#8243; title_text=&#8221;4. IF AND greater than_equal to&#8221; align=&#8221;center&#8221; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; width=&#8221;640px&#8221; max_width=&#8221;640px&#8221; height=&#8221;440px&#8221; max_height=&#8221;440px&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3>Tips for using the IF AND function combination in Excel<\/h3>\n<ul>\n<li>The IF AND combination is a much cleaner alternative to nested IF statements. Sometimes nested IF\u2019s are necessary, but if you can use IF and AND instead, do it!<\/li>\n<li>All logical expressions within the AND function must be true, otherwise it will return FALSE<\/li>\n<li>If you want to get a TRUE result if any of your logical expressions is true, you can use the OR function instead of AND<\/li>\n<\/ul>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The IF function in Excel is extremely useful: it generates different outcomes depending on whether the input meets a certain criteria. But what if you want the input to meet multiple criteria instead of just one? That\u2019s where the AND function comes in. When combined, the IF AND Excel functions create an even more powerful [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":31706,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[65],"tags":[39,48,28],"class_list":["post-31704","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel-functions","tag-connections-t","tag-excel","tag-spreadsheets"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/31704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/comments?post=31704"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/31704\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media\/31706"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media?parent=31704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/categories?post=31704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/tags?post=31704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}