跳到主要內容

如何確定日期是否介於兩個日期之間或在Excel中的周末?

有時您可能需要確定或檢查日期是否在Excel中的兩個日期之間或週末之間。 本文將向您展示以下棘手的方法來檢查日期是否介於Excel中的兩個日期或週末之間。

使用公式確定日期是否介於兩個日期之間
使用出色的工具輕鬆確定日期是否介於兩個日期之間  
使用公式和VBA代碼確定日期是否在周末
使用出色的工具確定日期是否在周末

有關日期的更多教程...


確定日期是否在Excel中的兩個日期之間

假設您需要確定A列中的日期是否介於7/1/2008和12/31/2009之間。 請執行以下操作:

1.在空白單元格中,說出單元格B2,將以下公式複制並粘貼到其中,然後按 Enter 鍵。

=IF(AND(A2>$B$1,A2<$c$1),A2, FALSE)

備註:此公式將檢查日期是否介於7/1/2008和12/31/2009之間。 如果日期在此期間,它將返回日期; 如果日期不在此期間,它將返回文本 .

2.繼續選擇結果單元格,向下拖動“填充手柄”以獲取所有結果。 看截圖:

現在,您可以確定日期是否在指定的日期範圍內。


使用Kutools for Excel確定日期是否在Excel中的兩個日期之間

在這里為您推荐一個了不起的工具- 選擇特定的單元格 的效用 Excel的Kutools。 此工具不僅可以幫助您找出介於兩個給定日期之間的所有日期,還可以立即選擇所有合格的日期單元格。
在應用它之前,您需要 首先下載並安裝.

1.選擇要確定其日期是否介於兩個日期之間的日期範圍,然後單擊 庫工具 > 選擇 > 選擇特定的單元格。 看截圖:

2。 在裡面 選擇特定的單元格 對話框中,選擇 細胞 在選項 選擇類型 部分,然後指定 比...更棒小於 日期,最後單擊 OK 按鈕。

您可以看到兩個日期之間的日期單元格被立即選擇。 看截圖:

  如果您想免費試用(30天)此實用程序, 請點擊下載,然後按照上述步驟進行操作。


使用公式和VBA代碼確定日期是否在周末

您可以按照以下步驟確定列A中的日期是否為周末:

方法A:使用公式檢查日期是否在周末。

1.在空白單元格中,將以下公式複制並粘貼到其中,然後按 Enter 鍵。

=IF(OR(WEEKDAY(A2)=1,WEEKDAY(A2)=7),A2,FALSE)

此公式將確定日期是否在周末。 如果日期在周末,它將返回日期; 如果日期不是在周末,它將返回文本 .

2.繼續選擇結果單元格,然後向下拖動“填充手柄”以獲取所有結果。

方法B:使用用戶定義的功能檢查日期是否在周末。

1。 按 ALT + F11 鍵一起打開Microsoft Visual Basic for Applications窗口。

2.在“ Microsoft Visual Basic for Applications”窗口中,單擊“ 插入 >> 模塊,然後將以下宏粘貼到“模塊窗口”中。

Public Function IsWeekend(InputDate As Date) As Boolean
Select Case Weekday(InputDate)
Case vbSaturday, vbSunday
IsWeekend = True
Case Else
IsWeekend = False
End Select
End Function

3.同時按Alt + Q鍵以關閉“ Microsoft Visual Basic應用程序”窗口。

4.在空白單元格中,在“公式欄”中輸入公式,然後按 Enter 鍵。

=IsWeekend(A2)

如果返回的文本 ,單元格A2中的日期為周末; 如果它返回的文本 ,單元格A2中的日期不會在周末。


使用出色的工具確定約會是否在周末進行

實際上,您可以將所有日期轉換為工作日名稱,然後根據星期六或星期日檢查週末。 在這裡 套用日期格式 的效用 Excel的Kutools 可以幫助您輕鬆解決問題。
在應用它之前,您需要 首先下載並安裝.

1.選擇日期範圍,然後單擊 庫工具 > 格式 > 套用日期格式。 看截圖:

2。 在裡面 套用日期格式 對話框中選擇 星期三 ,在 日期格式 框,然後單擊 OK 按鈕。

現在,所選日期將立即轉換為工作日。 您可以直接根據日期的內容確定日期是否在周末。 看截圖:

筆記:

  • 轉換後的結果直接在原始數據中起作用;
  • 該實用程序支持 復原按Ctrl + Z“。

  如果您想免費試用(30天)此實用程序, 請點擊下載,然後按照上述步驟進行操作。


相關文章:

在Excel中將日期轉換為工作日,月份,年份名稱或數字
假設您在一個單元格中輸入日期,日期顯示為12/13/2015。 有沒有辦法只顯示月份或工作日,或月份名稱或工作日名稱的文本,例如XNUMX月或週日? 本文中的方法可以幫助您輕鬆轉換或格式化任何日期,以僅在Excel中顯示工作日名稱或月份名稱。

在Excel中快速將生日轉換為年齡
例如,您在Excel中獲得了各種出生日期數據,並且需要轉換這些出生日期以在Excel中顯示其確切年齡值,您想如何計算? 本文列出了一些技巧,可以在Excel中輕鬆地將出生日期轉換為年齡。

如果日期大於Excel中的另一個日期,則比較日期
假設您有一個日期列表,並且想將這些日期與指定日期進行比較,以便找出比列表中指定日期大的日期,您將怎麼辦? 在本文中,我們將向您展示比較日期的方法(如果大於Excel中的另一個日期)。

Excel中兩個日期範圍之間的總和值
當工作表中有兩個列表時,一個是日期列表,另一個是值列表。 並且您只想對兩個日期範圍之間的值求和,例如,對3/4/2014和5/10/2014之間的值求和,如何快速計算它們? 本文中的方法將幫您一個忙。

在Excel中添加日期,包括或不包括週末和節假日
本文討論的是在給定日期中添加幾天(不包括週末和節假日),這意味著只能在Excel中添加工作日(從星期一到星期五)。

有關日期的更多教程...


使用Kutools for Excel確定日期是否介於兩個日期或週末之間

Excel的Kutools 包括300多個便捷的Excel工具。 60天免費試用,不受限制。 立即下載免費試用版!

最佳辦公生產力工具

🤖 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 (13)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have 4 variables: 1st: Date of onset, 2nd: Date of termination, 3rd: Date of measurement, 4th: measurement. I want to calculate the average of the 4th variable between each period of onset-termination. How can i do it? I think its a bit tricky. Each date of onset has an counterpart date of termination. The same applies for the 3rd and 4th variable.
This comment was minimized by the moderator on the site
I have two tables. The first table has a date and an ID and the other table has a range dates, the same ID and, and one code. In two tables repeat the ID because each has different information. I need get in the table number one the code according with the ID and range dates in the second table. But i don't know how???
This comment was minimized by the moderator on the site
I want to find all projects that fall within today's date +30 days (Within a month) and have the Project Number displayed when in the range, if not in range keep blank
This comment was minimized by the moderator on the site
i want to monitor the dates and set the the alert in my excel , example i want to set in my excel to find the difference days between the request date and deadline to order date and automatically compare this difference with the policy date if the difference is greater than policy date , excel consider not done with an alert color , and if the difference is less than the policy days , excel consider the done with alert color. thank you
This comment was minimized by the moderator on the site
Hello to all, I have a requirement in excel i.e. i want to generate dates if design actual date is delay for 2 days then for costing department date is increase by delay date. design target actual complete costing target marketing target 05-04-2016 07-04-2016 09-04-2016 10-04-2016 in above design target date is 05/04/2016 but design task completed on 07-04-2016 so costing target date will be automatically calculated as per delay days.
This comment was minimized by the moderator on the site
I am recording the SLA duration between dates 40 day SLA starting on day XXXX I am looking for a formula to show if client holds for x number of days that comes off the SLA too ie 01 june 2016 + 40 days = 11 July 2016 but project finishes 15 July shows as 4 days overdue However 01 June 2016 Start 15 July 2016 End date of project client Held 7 Day 3 days before SLA Any help?
This comment was minimized by the moderator on the site
I want to show a certain date in a cell from a date range which is between two dates. eg: 01-05-2016 to 05-05-2016 may shown as in other cell as 01-05-2016 . pls help me..
This comment was minimized by the moderator on the site
My question falls along these lines. I have two date ranges A through B, and X through Y. I need to conditionally format a cell if any dates in range A-B fall within range X-Y.
This comment was minimized by the moderator on the site
Using IF Function i need the following formula. Any one can assist On A2 cell I will provide a date. On B2 it should indicate 2 Days after A2. If the second day falls on Monday to Friday it should indicate the actual date. If the second day falls on Saturday or sunday it should indicate on Monday automatically On the same way I need third day,fourth day and fifth day using Macros. Also advice to how to create macros in Excel.
This comment was minimized by the moderator on the site
I want to know how many times a date or how many dates from a list are present in a range of dates. For example Date Range is 1-1-2014 31-1-2014. The date list is 05-01-2014 11-01-2014 19-01-2014 08-02-2014 want to know the excel formula for count how many times the above list of dates present in the above range of dates.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations