{"id":4100,"date":"2018-11-20T14:04:38","date_gmt":"2018-11-20T19:04:38","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=4100"},"modified":"2018-12-19T14:05:03","modified_gmt":"2018-12-19T19:05:03","slug":"did-you-know-you-can-use-microsoft-excel-to-count-the-number-of-records-within-a-range","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=4100","title":{"rendered":"Did you know \u2026 you can use Microsoft Excel to count the number of records within a range?"},"content":{"rendered":"\n<p>I\u2019ve been generating reports to track our Microsoft Teams adoption \u2013 how many people are using Teams, how many messages are being sent in Teams, how many Teams are there. Some of these metrics have easily visualized count-per-unit-time summaries available. Some, like the number of Teams, do not. <\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>\n  <strong>Team<\/strong>\n  <\/td><td>\n  <strong>Created On<\/strong>\n  <\/td><\/tr><tr><td>\n  Directory Services\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  App Proxy\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  LDAP\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  ADFS\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  Nagios\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  File Cluster\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  Exchange Online\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  Active Directory\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><tr><td>\n  Commvault\n  <\/td><td>\n  1\/19\/2017\n  <\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>But it\u2019s easy to turn a list of groups and creation dates into visualizable data. Paste the data into Excel. To find the number of items where \u201cCreated On\u201d falls in a range, we need to be able to define that range. 01 January 2017 is easy enough, but how do you get the <em>end<\/em> of January? Excel has a function, <a href=\"https:\/\/support.office.com\/en-us\/article\/eomonth-function-7314ffa1-2bc9-4005-9d66-f49db127d628\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"But it\u2019s easy to turn a list of groups and creation dates into visualizable data. Paste the data into Excel. To find the number of items where \u201cCreated On\u201d falls in a range, we need to be able to define that range. 01 January 2017 is easy enough, but how do you get the end of January? Excel has a function, EOMONTH, that returns the last day of a month.  (opens in a new tab)\">EOMONTH<\/a>, that returns the last day of a month. <\/p>\n\n\n\n<p>Date is any date object. Offset is an integer number of months prior (negative numbers) or after (positive numbers) Date for which you want the last day of the month. I can\u00a0list the dates to start and end quarters with =EOMonth(Date,2).\u00a0With 01 January 2017 in cell D2, the\u00a0<em>last<\/em>\u00a0day of January is =EOMonth(D2,0)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"801\" height=\"124\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/12\/Excel-CountIfS01.png\" alt=\"\" class=\"wp-image-4101\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS01.png 801w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS01-300x46.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS01-768x119.png 768w\" sizes=\"auto, (max-width: 801px) 100vw, 801px\" \/><\/figure>\n\n\n\n<p>\u00a0I don\u2019t want to type01 Feb, Mar, April \u2026 <a rel=\"noreferrer noopener\" aria-label=\"I don\u2019t want to type01 Feb, Mar, April \u2026 flash fill and the fillhandle needs a few values before it can figure out the rest of asequence. But I can use EOMONTH again to get the first day of a month \u2013 justadd one! With 31 January 2017 in cell E2, I want =EOMONTH(E2,0)+1 in cell D3.(Yes, there are other ways to do this \u2013 EOMONTH(D2,1) would give me the end ofFebruary as well \u2013 the number after the comma is an offset from the date beforethe comma) (opens in a new tab)\" href=\"https:\/\/support.office.com\/en-us\/article\/using-flash-fill-in-excel-3f9bcf1e-db93-4890-94a0-1578341f73f7\" target=\"_blank\">flash fill <\/a>and the <a href=\"https:\/\/support.office.com\/en-gb\/article\/copy-a-formula-by-dragging-the-fill-handle-in-excel-for-mac-dd928259-622b-473f-9a33-83aa1a63e218\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"I don\u2019t want to type01 Feb, Mar, April \u2026 flash fill and the fill handle need a few values before they can figure out the rest of a sequence. But I can use the last day of the month to get the first day of the next month \u2013 just add one! With 31 January 2017 in cell E2, I want =E2 + 1 in cell D3. (Yes, there are other ways to do this \u2013 probably dozens.) (opens in a new tab)\">fill handle<\/a> need a few values before they can figure out the rest of a sequence. But I can use the last day of the month to get the first day of the next month \u2013 just add one! With 31 January 2017 in cell E2, I want =E2 + 1 in cell D3. (Yes, there are other ways to do this \u2013 probably dozens.)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"150\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/12\/Excel-CountIfS02.png\" alt=\"\" class=\"wp-image-4102\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS02.png 644w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS02-300x70.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/figure>\n\n\n\n<p>Now that we\u2019ve got a formula for the start and end of the month, just <a rel=\"noreferrer noopener\" aria-label=\"Now that we\u2019ve got a formula for the start and end of the month, just fill down to produce the ranges we need to see how many Teams were created each month. Then we just need a formula to do the counting for us. Iuse the COUNTIFSfunction.  (opens in a new tab)\" href=\"https:\/\/support.office.com\/en-us\/article\/fill-a-formula-down-into-adjacent-cells-041edfe2-05bc-40e6-b933-ef48c3f308c6\" target=\"_blank\">fill down<\/a> to produce the ranges we need to see how many Teams were created each month. Then we just need a formula to do the counting for us. I use the <a href=\"https:\/\/support.office.com\/en-us\/article\/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Now that we\u2019ve got a formula for the start and end of the month, just fill down to produce the ranges we need to see how many Teams were created each month. Then we just need a formula to do the counting for us. I use the COUNTIFS function.  (opens in a new tab)\">COUNTIFS<\/a> function. <\/p>\n\n\n\n<p>=COUNTIFS($B$2:$B$1000,&#8221;&gt;=&#8221;&amp;D2,$B$2:$B$1000,&#8221;&lt;=&#8221;&amp;E2)<\/p>\n\n\n\n<p>Counts the number of items in the range $B$2:$B$1000 (the cell range is static as the formula is copied elsewhere, hence the <a href=\"https:\/\/support.office.com\/en-us\/article\/switch-between-relative-absolute-and-mixed-references-dfec08cd-ae65-4f56-839e-5f0d8d0baca9\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Counts the number of items in the range $B$2:$B$1000 (the cell range is static as the formula is copied elsewhere, hence the $\u2019s indicating an absolute reference) that are greater than or equal to D2 AND in the range $B$2:$B$1000 that are less than or equal to E2. We need to use an ampersand (&amp;) to join the comparison operator and the cell \u2013 \u201c>=D2\u201d would be comparing a number to a string, and you\u2019ll get 0.  (opens in a new tab)&#8221;>$\u2019s indicating an absolute reference<\/a>) that are greater than or equal to D2 AND in the range $B$2:$B$1000 that are less than or equal to E2. We need to use an ampersand (&amp;) to join the comparison operator and the cell \u2013 \u201c>=D2\u201d would be comparing a number to a string, and you\u2019ll get 0. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"297\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/12\/Excel-CountIfS03.png\" alt=\"\" class=\"wp-image-4103\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS03.png 930w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS03-300x96.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS03-768x245.png 768w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/figure>\n\n\n\n<p>Fill down \u2013 you\u2019ll see the range remains static, and the comparison is to the D and E columns on the current row. <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"244\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/12\/Excel-CountIfS04.png\" alt=\"\" class=\"wp-image-4104\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS04.png 938w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS04-300x78.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS04-768x200.png 768w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><\/figure>\n\n\n\n<p>Voila \u2013 easily visualized data. And a graph \ud83d\ude0a\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"416\" src=\"http:\/\/lisa.rushworth.us\/wp-content\/uploads\/2018\/12\/Excel-CountIfS05.png\" alt=\"\" class=\"wp-image-4105\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS05.png 722w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2018\/12\/Excel-CountIfS05-300x173.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve been generating reports to track our Microsoft Teams adoption \u2013 how many people are using Teams, how many messages are being sent in Teams, how many Teams are there. Some of these metrics have easily visualized count-per-unit-time summaries available. Some, like the number of Teams, do not. Team Created On Directory Services 1\/19\/2017 App &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[677],"tags":[675,709,729,731,265],"class_list":["post-4100","post","type-post","status-publish","format-standard","hentry","category-office-365","tag-did-you-know","tag-microsoft-excel","tag-microsoft-office-365","tag-ms-excel","tag-office-365"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/4100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4100"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/4100\/revisions"}],"predecessor-version":[{"id":4106,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/4100\/revisions\/4106"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}