跳到主要内容

如何在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)), 按 输入 键以计算匹配行的总数。 看截图:
日期之间的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 的“选择特定单元格”功能。

Kutools for Excel, 与超过 300 方便的功能,使您的工作更加轻松。 

安装后 Kutools for Excel,请执行以下操作:(立即免费下载Kutools for Excel!)

1.选择要提取的数据,单击 库工具 > 选择 > 选择特定的单元格。 看截图:
日期之间的doc提取记录7

2.在 选择特定的单元格 对话框,检查 整行 选项,然后选择 比...更棒小于 从下拉列表中,在文本框中键入开始日期和结束日期,请记住检查 。 看截图:
日期之间的doc提取记录8

3。 点击 Ok > OK。 并且已选择与日期匹配的行。 按 按Ctrl + C 复制行,然后选择一个空白单元格,然后按 按Ctrl + V 粘贴,请看截图:
日期之间的doc提取记录9

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 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