{"id":9939,"date":"2023-04-04T13:52:26","date_gmt":"2023-04-04T18:52:26","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=9939"},"modified":"2023-04-07T11:32:18","modified_gmt":"2023-04-07T16:32:18","slug":"using-excel-to-turn-week-of-month-and-day-of-week-into-actual-dates","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=9939","title":{"rendered":"Using Excel to turn week of month and day of week into actual dates"},"content":{"rendered":"<p>Our patching schedules are algorithmic \u2013 the 1<sup>st<\/sup> Tuesday of the month, the 3<sup>rd<\/sup> Wednesday of the month, etc. But that\u2019s not particularly useful for notifying end users or for us to verify functionality after patching.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1316\" height=\"460\" class=\"wp-image-9940\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-table-description-autom.png\" alt=\"Graphical user interface, table Description automatically generated\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-table-description-autom.png 1316w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-table-description-autom-300x105.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-table-description-autom-1024x358.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-table-description-autom-768x268.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-table-description-autom-750x262.png 750w\" sizes=\"auto, (max-width: 1316px) 100vw, 1316px\" \/><\/p>\n<p>Long term, I think we can pull the source data from a database and create appointment items each month for whatever list of servers will be patched that month <a href=\"https:\/\/dateutil.readthedocs.io\/en\/stable\/relativedelta.html\" target=\"_blank\" rel=\"noopener\">based on a relative date<\/a> (so no one has to add new servers or remove decommissioned servers). But, short term? I really wanted a way to see what <em>date<\/em> a server would be patched. So I created a but of a convoluted spreadsheet to produce this information based on a list of servers and patching schedule patterns.<\/p>\n<p>There are two \u201cextra\u201d tabs used \u2013 \u201cDates\u201d used to say what month and year I want the patching dates for<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"333\" height=\"512\" class=\"wp-image-9941\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce.png\" alt=\"Graphical user interface, application, table, Excel Description automatically generated\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce.png 333w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-195x300.png 195w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><\/p>\n<p>And \u201cServerData\u201d which provides a cross-reference between the server names and a useful description.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"482\" class=\"wp-image-9942\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-1.png\" alt=\"Graphical user interface, application, table, Excel Description automatically generated\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-1.png 523w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-1-300x276.png 300w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/p>\n<p>There are then a series of formulae used to add columns to our source data. First, the \u201cFunction\u201d is populated in column G with a VLOOKUP =VLOOKUP(B2,ServerData!A:B,2,FALSE)<\/p>\n<p>Columns I and J break the \u201c1<sup>st<\/sup> Saturday\u201d into the two components \u2013 week of month and day of week \u2013<\/p>\n<p>I =LEFT(C2,3)<br \/>\nJ =RIGHT(C2,LEN(C2)-4)<\/p>\n<p>Columns K and L then map these components into numeric values I can use in a formula:<\/p>\n<p>K =IF(I2=&#8221;1st&#8221;,1,IF(I2=&#8221;2nd&#8221;,2,IF(I2=&#8221;3rd&#8221;,3,IF(I2=&#8221;4th&#8221;,4,&#8221;Unscheduled&#8221;))))<br \/>\nL =IF(J2=&#8221;Sunday&#8221;,1,IF(J2=&#8221;Monday&#8221;,2,IF(J2=&#8221;Tuesday&#8221;,3,IF(J2=&#8221;Wednesday&#8221;,4,IF(J2=&#8221;Thursday&#8221;,5,IF(J2=&#8221;Friday&#8221;,6,IF(J2=&#8221;Saturday&#8221;,7,&#8221;Unscheduled&#8221;)))))))<\/p>\n<p>And finally a formula in column H that turns the week of month and day of week values into an actual date within the month and year on the \u201cDates\u201d tab:<\/p>\n<p>H =DATE(Dates!$B$2,Dates!$A$2,1+7*K2)-WEEKDAY(DATE(Dates!$B$2,Dates!$A$2,8-L2))<\/p>\n<p>Voila \u2013 I have a spreadsheet that says we should expect to see this specific list of servers being patched tonight.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1343\" height=\"487\" class=\"wp-image-9943\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-2.png\" alt=\"Graphical user interface, application, table, Excel Description automatically generated\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-2.png 1343w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-2-300x109.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-2-1024x371.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-2-768x278.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/04\/graphical-user-interface-application-table-exce-2-750x272.png 750w\" sizes=\"auto, (max-width: 1343px) 100vw, 1343px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our patching schedules are algorithmic \u2013 the 1st Tuesday of the month, the 3rd Wednesday of the month, etc. But that\u2019s not particularly useful for notifying end users or for us to verify functionality after patching. Long term, I think we can pull the source data from a database and create appointment items each month &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":[708,710,709,691,729,731,265,705],"class_list":["post-9939","post","type-post","status-publish","format-standard","hentry","category-office-365","tag-excel","tag-excel-functions","tag-microsoft-excel","tag-microsoft-office","tag-microsoft-office-365","tag-ms-excel","tag-office-365","tag-office365"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/9939","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=9939"}],"version-history":[{"count":2,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/9939\/revisions"}],"predecessor-version":[{"id":9945,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/9939\/revisions\/9945"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}