跳到主要內容

如何在Excel中提取兩個日期之間的所有記錄?

這是Excel中的一系列數據,在這種情況下,我想提取兩個日期之間的所有行記錄,如下圖所示,您是否有任何想法可以快速處理此作業,而無需查找數據並手動逐個提取它們?

日期之間的doc提取記錄1 向右射箭 日期之間的doc提取記錄2

通過公式提取兩個日期之間的所有記錄

通過Kutools for Excel提取兩個日期之間的所有記錄好主意3


通過公式提取兩個日期之間的所有記錄

要提取Excel中兩個日期之間的所有記錄,您需要執行以下操作:

1.創建一個新工作表Sheet2,並在兩個單元格(例如A1和B1)中鍵入開始日期和結束日期。 看截圖:
日期之間的doc提取記錄3

2.在Sheet1的C2中,鍵入此公式, =SUMPRODUCT((Sheet1!$A$2:$A$22>=A2)*(Sheet1!$A$2:$A$22<=B2)), 按 Enter 鍵以計算匹配行的總數。 看截圖:
日期之間的doc提取記錄4

注意: 在公式中,Sheet1是包含要從中提取原始數據的工作表,$ A $ 2:$ A $ 22是數據范圍,A2和B2是開始日期和結束日期。

3.選擇一個空白單元格,您將放置提取的數據,鍵入此公式 =IF(ROWS(A$5:A5)>$C$2,"",INDEX(Sheet1!A$2:A$22,SMALL(IF((Sheet1!$A$2:$A$22>=$A$2)*(Sheet1!$A$2:$A$22<=$B$2),ROW(Sheet1!A$2:A$22)-ROW(Sheet1!$A$2)+1),ROWS(A$5:A5)))), 按 Shift + Ctrl + 輸入 鍵,然後在列和行上拖動自動填充手柄以提取所有數據,直到出現空白單元格或零值。 看截圖:
日期之間的doc提取記錄5

4.刪除零,然後選擇顯示為5位數字的日期,請轉到 首頁 選項卡,然後選擇 短期約會 在常規下拉列表中將其格式化為日期格式。 看截圖:
日期之間的doc提取記錄6


通過Kutools for Excel提取兩個日期之間的所有記錄

如果您想更輕鬆地處理此工作,可以嘗試使用Kutools for Excel的“選擇特定單元格”功能。

Excel的Kutools, 與以上 300 方便的功能,使您的工作更加輕鬆。 

安裝後 Kutools for Excel,請執行以下操作:(立即免費下載Kutools for Excel!)

1.選擇要提取的數據,單擊 庫工具 > 選擇 > 選擇特定的單元格。 看截圖:
日期之間的doc提取記錄7

2。 在裡面 選擇特定的單元格 對話框,檢查 整行 選項,然後選擇 比...更棒小於 從下拉列表中,在文本框中鍵入開始日期和結束日期,請記住檢查 。 看截圖:
日期之間的doc提取記錄8

3。 點擊 Ok > OK。 並且已選擇與日期匹配的行。 按 按Ctrl + C 複製行,然後選擇一個空白單元格,然後按 按Ctrl + V 粘貼,請看截圖:
日期之間的doc提取記錄9

最佳辦公生產力工具

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

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

kte選項卡201905


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

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (19)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi, this formula worked ok, except it only returned one data set for each date in the range. Is there an adjustment to allow for multiple entries with the dame date value?
This comment was minimized by the moderator on the site
This formula works awesome thanks, I need some extra help though. I have 200 employees, each with certification that expires on different dates. The heading for each certification is at the top with their expiry dates below. I want to extract the rows that with all info if there is an expiry reached and throw them into a new sheet. Exactly like the example above just dated from multiple columns.
This comment was minimized by the moderator on the site
Hi, Christiaan82, could you upload the a screenshot about you workhsheet, or give me more details about the information of sheet format, only with your description, I do not get it clearly.
This comment was minimized by the moderator on the site
All sorted. Instead of trying to retrieve the rows from multiple columns, I added a new hidden sheet where all the info populates the info on top of each other. So the information only needs to be retrieved from one column, as per your example above.
Thank you Sunny
This comment was minimized by the moderator on the site
"drag Auto fill handle over columns and rows to extract all data until blank cells or zero values appear."
This doesn't seem to be working for me. The first row gives me the dates but the same gets repeated in the next two rows.
This comment was minimized by the moderator on the site
Hi, Neha, could you check if your auto calculate is turn on? Click Formulas > Calcuations Options > Automatic.
This comment was minimized by the moderator on the site
it worked well for single sheet. can u pls help me to get the same from multiple sheets of similar data. first 4 sheets contain similar data. i need all records of same 'date' in sheet5.
This comment was minimized by the moderator on the site
Can you extend the formula to check for dates that encompass more than one day? For example, using the same start and end dates from 1/1/15-12/31/16, but the data in sheet 1 have start and end dates too rather than just existing for a singular date.
This comment was minimized by the moderator on the site
This formula worked brilliantly. I was concerned as I have multiple date duplicates and there was no mention of how it handles those; no issues. It returned all relevant data.
Stoked.
This comment was minimized by the moderator on the site
Thanks for your support, you can combined the duplicate dates cells after extracting.
This comment was minimized by the moderator on the site
The trouble I am having because I need to find dates that run through the date range specified. So I want anything that runs through something like 1/2016 to 12/2017, however it needs to include start dates that may be before the range so I can identify the records I need to look at.
This comment was minimized by the moderator on the site
I used this code and it is pulling up dates outside of the window... how do I fix it?
This comment was minimized by the moderator on the site
Which code Kayla? Do you mean the formula?
This comment was minimized by the moderator on the site
I recreated this example in Excel 2010, and the result was that the first row of data would show up, but everything underneath had a number error.
This comment was minimized by the moderator on the site
Same thing happens to me n Excel 2010. Something in the formula doesn't work correctly.
This comment was minimized by the moderator on the site
Have you pressed Shift + Ctrl + Enter keys?
This comment was minimized by the moderator on the site
I see what's wrong. You have to press the shift + CTRL + Enter keys while still in edit mode.
I was hitting those keys after entering the formula and hitting ENTER.
I wish it would have been clearer.
This comment was minimized by the moderator on the site
Yes, brian, after typing the formula and still in edit mode, directly press Shift + Ctrl + Enter keys (the keys instead of Enter key), to get the correct result.
This comment was minimized by the moderator on the site
Still doesnt work for me? I am doing exactly as above and still returning the NUM error? Any other ideas?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations