{"id":3242,"date":"2021-04-19T09:26:54","date_gmt":"2021-04-19T16:26:54","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3242"},"modified":"2021-04-20T10:12:53","modified_gmt":"2021-04-20T17:12:53","slug":"how-to-count-the-number-of-weekends-weekdays-between-two-dates-in-excel","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3242","title":{"rendered":"How To Count The Number Of Weekends\/Weekdays Between Two Dates In Excel?"},"content":{"rendered":"\n<p>Sometimes, we need to know how many specific weekdays between two dates. For example, I have two dates: the start date is 1\/1\/2014 and the end date is 2\/15\/2014, now I want to know how many times a Sunday or a Monday or a Tuesday etc occurs in this duration. Maybe this is somewhat difficult for us, but here, I can talk about some effective methods for you.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">&nbsp;<strong>Count The Number Of Specific Weekdays\/Weekends Between Two Dates With Formula<\/strong><\/h4>\n\n\n\n<p>Supposing, I have the following two dates, and I need to count how many Sundays between them. Select a blank cell, enter below formula, and press the&nbsp;<strong>Enter<\/strong>&nbsp;key. And now you will get the number of Sundays between the two dates. See screenshot:<br><img decoding=\"async\" src=\"https:\/\/cdn.extendoffice.com\/images\/stories\/doc-excel\/count-weekday-weekend\/doc-count-weekday-weekend-001.png\" alt=\"\"><\/p>\n\n\n\n<p>=INT((WEEKDAY($C$2- 1)-$C$2+$C3)\/7)<\/p>\n\n\n\n<p>Another Sample here:<\/p>\n\n\n\n<p>=INT((WEEKDAY($C$4-1)-$C$4+$C$5)\/7)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"905\" height=\"489\" src=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image.png\" alt=\"\" class=\"wp-image-3250\" srcset=\"https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image.png 905w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-300x162.png 300w, https:\/\/SUMMALAI.COM\/wp-content\/uploads\/2021\/04\/image-768x415.png 768w\" sizes=\"(max-width: 905px) 100vw, 905px\" \/><\/figure>\n\n\n\n<p><strong>Notes:<\/strong><\/p>\n\n\n\n<p>(1) In the above formula, C2 is the start date and C3 indicates the end date.<\/p>\n\n\n\n<p>(2) In above formula,&nbsp;<strong>1<\/strong>&nbsp;stands for Sunday. And you can replace the number 1 with other numbers between 1 and 7. (<strong>1 is Sunday, 2 is Monday, 3 is Tuesday, 4 is Wednesday, 5 is Thursday, 6 is Friday and 7 is Saturday<\/strong>)<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">&nbsp;<strong>Use Formula To Count The Number Of Specific Weekday In Month<\/strong><\/h4>\n\n\n\n<p>Sometimes, you may need to count the total number of a certain weekday in the given month, says count the total number of Wednesday in July, 2020. Here, I will introduce a formula to count the total number of a certain weekday in the specified month easily.<\/p>\n\n\n\n<p>Select a blank cell, type below formula, and press the Enter key to get the counting result.<br><img decoding=\"async\" src=\"https:\/\/cdn.extendoffice.com\/images\/stories\/doc-excel\/count-weekday-weekend\/doc-count-weekday-weekend-002.png\" alt=\"\"><\/p>\n\n\n\n<p>=INT((WEEKDAY(DATE(G2,G3,1)- G4)-DATE(G2,G3,1)+EOMONTH(DATE(G2,G3,1),0))\/7)<\/p>\n\n\n\n<p><strong>Notes<\/strong>:<\/p>\n\n\n\n<p>(1) In above formula, G2 is the specified year, G3 is the specified month, and G4 is the specified day of week.<\/p>\n\n\n\n<p>(2) This formula assigns integers to represent day of weeks: 1 is Sunday, 2 is Monday, 3 is Tuesday, 4 is Wednesday, 5 is Thursday, 6 is Friday, and 7 is Saturday.<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h4 class=\"wp-block-heading\">&nbsp;<strong>Use User Defined Function To Count The Number Of Specific Weekdays\/Weekends In A Given Month<\/strong><\/h4>\n\n\n\n<p>You can also create a User Defined Function to calculate how many specific weekdays in a given year and month besides the above formula.<\/p>\n\n\n\n<p><strong>1<\/strong>. Hold down the&nbsp;<strong>ALT + F11<\/strong>&nbsp;keys, and it opens the&nbsp;<strong>Microsoft Visual Basic for Applications window<\/strong>.<\/p>\n\n\n\n<p><strong>2<\/strong>. Click&nbsp;<strong>Insert<\/strong>&nbsp;&gt;&nbsp;<strong>Module<\/strong>, and paste the following code in the&nbsp;<strong>Module Window<\/strong>.<\/p>\n\n\n\n<p>Public Function TotalDays(pYear As Integer, pMonth As Integer, pDay As Integer)<br>Dim xindex As Integer<br>Dim endDate As Integerend<br>Date = Day(DateSerial(pYear, pMonth + 1, 0))<br>For xindex = 1 To endDate<br>If Weekday(DateSerial(pYear, pMonth, xindex)) = pDay Then<br>TotalDays = TotalDays + 1<br>End If<br>Next<br>End Function<\/p>\n\n\n\n<p><strong>3<\/strong>. Save this code and return to the worksheet, then in a blank cell, enter this formula&nbsp;<strong>= TotalDays(year, month, 1)<\/strong>&nbsp;. In this example, I will count how many Sundays there are in June 2020, so I can apply this formula as one of below formulas<strong><\/strong>, then press&nbsp;<strong>Enter<\/strong>&nbsp;key, and you will get how many Sundays at once. see screenshots:<br><img decoding=\"async\" src=\"https:\/\/cdn.extendoffice.com\/images\/stories\/doc-excel\/count-weekday-weekend\/doc-count-weekday-weekend-003.png\" alt=\"\"><\/p>\n\n\n\n<p>=TotalDays(C2,C3,C4)<\/p>\n\n\n\n<p>=TotalDays(2020,6,1)<\/p>\n\n\n\n<p><strong>Notes:<\/strong>&nbsp;This formulas use integers to represent day of weeks:&nbsp;<strong>1 is Sunday, 2 is Monday, 3 is Tuesday, 4 is Wednesday, 5 is Thursday, 6 is Friday and 7 is Saturday<\/strong>.<\/p>\n\n\n\n<p>Ref: https:\/\/www.extendoffice.com\/documents\/excel\/1421-excel-count-mondays-sundays-between-two-dates.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, we need to know how many specific weekdays between two dates. For example, I have two dates: the start date is 1\/1\/2014 and the end date is 2\/15\/2014, now I want to know how many times a Sunday or a Monday or a Tuesday etc occurs in this duration. Maybe this is somewhat difficult <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3242\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10,18],"tags":[691,690],"class_list":["post-3242","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-microsoft-office","tag-count-the-number-of-weekdays","tag-count-the-number-of-weekends"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3242"}],"version-history":[{"count":4,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3242\/revisions"}],"predecessor-version":[{"id":3251,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3242\/revisions\/3251"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}