{"id":1062,"date":"2017-12-26T06:06:58","date_gmt":"2017-12-26T00:06:58","guid":{"rendered":"http:\/\/xlfxs.com\/?p=1062"},"modified":"2017-12-26T06:06:58","modified_gmt":"2017-12-26T00:06:58","slug":"get-monthly-total-from-table-with-dates","status":"publish","type":"post","link":"https:\/\/xlfxs.com\/?p=1062","title":{"rendered":"Get monthly total from table with dates"},"content":{"rendered":"<p>Again, thanks to one of my students, I am getting another post with example \ud83d\ude42<br \/>\nI did promise her to post it after she sounded interesting in getting this example<\/p>\n<p>Here is an example on <strong>how to calculate total amounts of dollars per month (and number of days) from a table with dates<\/strong><\/p>\n<p>The tricky part is dates, you need to get total by month, while you have dates, and not months, it does not seam to have a direct way<\/p>\n<h3>Why SUMIF can&#8217;t help?<\/h3>\n<p>SUMIF does not help here, because it only works for one condition, we need two<\/p>\n<p>We need to get total of a certain column if date is between 1st of month, and end of month, which actually are two conditions and not one<\/p>\n<h3>So, how can we do that?<\/h3>\n<p>When we have a table like below<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/andor0.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1156 size-full\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/andor0.jpg\" alt=\"\" width=\"438\" height=\"297\"><\/a><\/p>\n<p>And we need to get the monthly total of amount, in column in G<\/p>\n<p>SUMIFS is the way to do that, it was added in Excel2010, I would guess based on demand?<\/p>\n<p>Anyways, SUMIFS works like SUMIF, but it can handle multiple conditions, up to 256, with AND.<\/p>\n<p>Means it will get the total of a column, if (and only if) all conditions are met<\/p>\n<p>The flexibility of SUMIFS gives us a lot of features, as we have it below, SUMIFS (along with other functions like DATE, YEAR, etc.) can get us the monthly total of amount.<\/p>\n<p><code>=SUMIFS(E:E,D:D,\"&gt;=\"&amp;DATE(YEAR(D5),MONTH(D5),1),D:D,\"&lt;\"&amp;DATE(YEAR(D5),MONTH(D5)+1,1))<\/code><\/p>\n<p>If this complicated, we will break it down.<\/p>\n<p>We are building the conditions inside SUMIFS, by saying&#8230;<\/p>\n<p>If the date is more than or equal first of that month, and date is less than the 1st of next month, then get amount<\/p>\n<p>So we created the two dates, 1st of this month, and 1st of next month, using DATE, with YEAR and MONTH as highlighted in screenshot<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifs1-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1158 size-full\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifs1-1.jpg\" alt=\"\" width=\"999\" height=\"485\"><\/a><\/p>\n<p>Then we used &amp; to concatenate the criteria in Criteria1 and Criteria2<\/p>\n<p>Then we asked SUMIFS to do the rest<\/p>\n<p>Anytime you do changes, you can see those numbers updated as we expected<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifs1-1-e1514246675501.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1158\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifs1-1-e1514246675501-300x202.jpg\" alt=\"\" width=\"372\" height=\"251\"><\/a> <a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifsq.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1160\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifsq-300x199.jpg\" alt=\"\" width=\"335\" height=\"222\"><\/a><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifs2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1159\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/12\/sumifs2-300x224.jpg\" alt=\"\" width=\"300\" height=\"224\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>What if I cannot do SUMIFS?<\/h3>\n<p>Of course back in the day before SUMIFS we did another trick<\/p>\n<p>Which is adding the month and year in a separate column, then do the Sum using SUMIF having condition on that column<\/p>\n<p>But that should be in another article &#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Again, thanks to one of my students, I am getting another post with example \ud83d\ude42 I did promise her to post it after she sounded interesting in getting this example Here is an example on how to calculate total amounts of dollars per month (and number of days) from a table with dates The tricky&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"https:\/\/xlfxs.com\/?p=1062\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;Get monthly total from table with dates&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1156,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[76,42,57,58,65],"tags":[],"class_list":["post-1062","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-date","category-month","category-sumif","category-sumifs","category-year"],"_links":{"self":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/1062","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=1062"}],"version-history":[{"count":0,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/1062\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/media\/1156"}],"wp:attachment":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}