{"id":737,"date":"2017-12-25T22:04:42","date_gmt":"2017-12-25T16:04:42","guid":{"rendered":"http:\/\/xlfxs.com\/?p=737"},"modified":"2017-12-25T22:04:42","modified_gmt":"2017-12-25T16:04:42","slug":"if-with-and-and-if-with-or","status":"publish","type":"post","link":"https:\/\/xlfxs.com\/?p=737","title":{"rendered":"IF with AND and IF with OR"},"content":{"rendered":"<p>The powerful function If can already do a lot of tricks, but we can for sure do more when we use it with AND or OR functions.<\/p>\n<p>Also, once we understand that, we can use the power of combining AND and OR inside the Logical test of IF, to make it even smarter<\/p>\n<p>Once good example is when we need to see if a certain date is within the same month as this month like below&#8230;<br \/>\n<!--more--><\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/andor0.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1156\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/andor0-300x203.jpg\" alt=\"\" width=\"300\" height=\"203\"><\/a><\/p>\n<p>If you use simple IF with MONTH (one condition)&#8230;<\/p>\n<p><code>=IF(Month(F2)=Month(Today()),\"This Month\",\"\")<\/code><\/p>\n<p>You will get &#8220;This Month&#8221; even if it was not same year<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/andor3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1151 size-full\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/andor3.jpg\" alt=\"\" width=\"533\" height=\"250\"><\/a><\/p>\n<p>Which we do not want for sure<\/p>\n<p>&nbsp;<\/p>\n<p>So, we can use AND function to make sure both conditions are met at the same time, at that time only, the test will get a TRUE output<br \/>\n<code><br \/>\n=IF(AND(MONTH(D5)=MONTH(TODAY()),YEAR(D5)=YEAR(TODAY())),\"This month\",\"No\")<\/code><\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/andor1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1152\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/andor1-300x104.jpg\" alt=\"\" width=\"516\" height=\"179\"><\/a> <a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/andor2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1153\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/02\/andor2-300x183.jpg\" alt=\"\" width=\"300\" height=\"183\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>AND() function can combine 256 conditions, if all TRUE, it will return a TRUE, while OR() only one of these conditions may return TRUE to result in TRUE<\/p>\n<p>Let me know if that helped in anyway, or not<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The powerful function If can already do a lot of tricks, but we can for sure do more when we use it with AND or OR functions. Also, once we understand that, we can use the power of combining AND and OR inside the Logical test of IF, to make it even smarter Once good&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"https:\/\/xlfxs.com\/?p=737\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;IF with AND and IF with OR&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1153,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68,3,80,35,48,6],"tags":[],"class_list":["post-737","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-and","category-formulas","category-if","category-logical","category-or","category-standard_functions"],"_links":{"self":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=737"}],"version-history":[{"count":0,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/737\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/media\/1153"}],"wp:attachment":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}