跳到主要內容

如何在Excel中列出一個月中的所有星期一/星期五?

在某些情況下,您可能需要在工作表中列出或顯示一個月或一年中的所有星期一或星期五。 通常,您可以使用“填充句柄”列出一系列日期,但是它無法幫助您填寫一個月或一年中的每個星期一或星期五。 本文,我將討論如何在Excel中列出一個月中的所有星期一或星期五。

用公式列出一個月或一年中的所有星期一/星期五

使用Kutools for Excel列出一個月或一年中的所有星期一/星期五


用公式列出一個月或一年中的所有星期一/星期五

以下公式可以幫助您列出一個月或一年中某個月中給定日期的所有星期一或星期五,請執行以下操作:

1. 請在單元格中輸入要列出的每個月的每個星期一或星期五的日期,例如,我將在單元格A1中輸入1/2016/1。

2. 然後輸入以下公式: =IF(WEEKDAY(EOMONTH(A1,-1)+1)=2,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(2,7))-WEEKDAY(EOMONTH(A1,-1)+1)) 進入單元格B1,然後按 Enter 獲取每月第一個星期一的密鑰。 看截圖:

doc列出所有星期一1

注意: 要獲得本月的第一個星期二:

=IF(WEEKDAY(EOMONTH(A1,-1)+1)=3,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(3,7))-WEEKDAY(EOMONTH(A1,-1)+1))

要獲得本月的第一個星期三:

=IF(WEEKDAY(EOMONTH(A1,-1)+1)=4,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(4,7))-WEEKDAY(EOMONTH(A1,-1)+1))

要獲得本月的第一個星期四:

=IF(WEEKDAY(EOMONTH(A1,-1)+1)=5,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(5,7))-WEEKDAY(EOMONTH(A1,-1)+1))

要獲得本月的第一個星期五:

=IF(WEEKDAY(EOMONTH(A1,-1)+1)=6,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(6,7))-WEEKDAY(EOMONTH(A1,-1)+1))

要獲得本月的第一個星期六:

=IF(WEEKDAY(EOMONTH(A1,-1)+1)=7,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(7,7))-WEEKDAY(EOMONTH(A1,-1)+1))

要獲得本月的第一個星期日:

=IF(WEEKDAY(EOMONTH(A1,-1)+1)=1,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(1,7))-WEEKDAY(EOMONTH(A1,-1)+1))

3. 顯示第一個星期一後,請繼續輸入以下公式: = B1 + 7 要獲取第二個星期一,然後向下拖動填充手柄以根據需要列出一個月或一年中的所有星期一,請參見屏幕截圖:

doc列出所有星期一2


使用Kutools for Excel列出一個月或一年中的所有星期一/星期五

除了上述公式之外,我在這裡可以介紹一個簡單的工具-Excel的Kutools,其 插入日期 功能,您可以盡快插入一個月中的所有星期一或星期五。

Excel的Kutools : 帶有300多個便捷的Excel加載項,可以在30天內免費試用

安裝後 Excel的Kutools,請執行以下操作: 立即下載Excel的Kutools! )

1。 選擇一個單元格以插入日期,然後單擊 庫工具 > 插入 > 插入日期,請參見屏幕截圖:

2。 在 插入日期 對話框中,將顯示一個月日曆,您可以雙擊日期以將其插入到單元格中,也可以通過選中以下內容來更改日期格式 使用格式 選項以激活日期格式列錶框。 看截圖:

去下載Kutools for Excel並立即免費試用!


演示:用Kutools for Excel列出一個月或一年中的所有星期一/星期五

Excel的Kutools:具有300多個方便的Excel加載項,可以在30天內免費試用,沒有任何限制。 立即下載並免費試用!

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thank you for the formula. I had a question about it. It does work for 2016, but when entering 1/12017, it identifies the first Monday of the month to be 1/9/17, when it's actually 1/2/17. Am I misunderstanding the formula's intent? Meaning, should I enter a different date to pull the 1/2/17 date? Thanks again for the help.
This comment was minimized by the moderator on the site
Did not work for me on every Monday that was in a month with the first day being a Sunday,

Given A1 is the first of the month "1/1/2020" or "1/2/2020" etc, This did work for me:


=A1+MOD(8-WEEKDAY(A1,2),7)
This comment was minimized by the moderator on the site
It worked for me.. fo rFridays A1= 06/01/2017 B1= 13/01/2017= IF(WEEKDAY(EOMONTH(A1,-1)+1)=6,EOMONTH(A1,-1)+1,EOMONTH(A1,-1)+(8 + MOD(6,7))-WEEKDAY(EOMONTH(A1,-1)+1)) 20/01/2017 = IF(WEEKDAY(EOMONTH(B1,-1)+1)=6,EOMONTH(B1,-1)+1,EOMONTH(B1,-1)+(8 + MOD(6,7))-WEEKDAY(EOMONTH(B1,-1)+1))+7 27/01/2017=IF(WEEKDAY(EOMONTH(C1,-1)+1)=6,EOMONTH(C1,-1)+1,EOMONTH(C1,-1)+(8 + MOD(6,7))-WEEKDAY(EOMONTH(C1,-1)+1))+
This comment was minimized by the moderator on the site
That doesn't help... super weird..2017 is the only year that it skips the 1st monday.
This comment was minimized by the moderator on the site
The formula doesn't work for Mondays if the last day of the previous month is a Saturday (weekday no 7). The following day is therefore a Sunday (weekday no 1) and you only need add 1 day to get to a Monday. However, the formula adds 10-1=9 days and gives you the 9th January as the first Monday. There needs to be a second IF function:
=IF(WEEKDAY(EOMONTH(A2,-1)+1)=1,EOMONTH(A2,-1)+2,IF(WEEKDAY(EOMONTH(A2,-1)+1)=2,EOMONTH(A2,-1)+1,EOMONTH(A2,-1)+(8+MOD(2,7))-WEEKDAY(EOMONTH(A2,-1)+1)))
This comment was minimized by the moderator on the site
The formula doesn't work if the last day of the previous month is a Saturday (weekday no 7). The following day is therefore a Sunday (weekday no 1) and you only need add 1 day to get to a Monday. However, the formula adds 10-1=9 days and gives you the 9th January as the first Monday. There needs to be a second IF function:=IF(WEEKDAY(EOMONTH(A2,-1)+1)=1,EOMONTH(A2,-1)+2,IF(WEEKDAY(EOMONTH(A2,-1)+1)=2,EOMONTH(A2,-1)+1,EOMONTH(A2,-1)+(8+MOD(2,7))-WEEKDAY(EOMONTH(A2,-1)+1)))
This comment was minimized by the moderator on the site
2019 too :( first wednesday is not 09 Jan?)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations