跳到主要内容

如何在Excel中检查时间是否介于两次之间?

在Excel中,如何检查特定时间是否介于两个给定时间之间? 要一一检查它们会浪费很多时间,在这里,我将介绍一些简单的公式来解决此工作。

使用公式检查特定时间是否在两个给定时间之间


箭头蓝色右气泡 使用公式检查特定时间是否在两个给定时间之间

例如,我有两列时间,分别是A列和B列中的开始时间和结束时间,现在我想检查C列中的时间是否在A列和B列的时间范围之间,如下图所示:

doc检查时间1之间的时间

以下公式可以帮助您确定特定时间是否在两次之间,请按照以下步骤操作:

在要输出结果的数据旁边的空白单元格中输入以下任一公式:

= IF(C2 = MEDIAN(A2,B2,C2),“是”,“否”)

=IF(AND(C2>=MIN(A2:B2),C2<=MAX(A2:B2)),"YES","NO")

然后将填充手柄向下拖动到要应用此公式的单元格上,并且已经确定了两次之间的时间(如果两次之间),则显示“是”(如果两次之间不是)次,将显示“否”,请参见屏幕截图:

doc检查时间2之间的时间

请注意: 在上述公式中, C2 是您要检查的特定时间,并且 A2B2 单元格包含您要基于的两次检查。

最佳办公生产力工具

🤖 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 (22)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Curious how to write a formula that results a number (1) to count a person present at a specific time.
For example: If I need to know that a person was present at 2:45pm, during these 5 schedules.
IN OUT 2:45pm
11:00 5:00PM 1
12:00 4:13PM 1
9:00 5:00PM 1
7:47 2:10PM 0
3:50 6:00PM 0

Need to result a 1 - if they arrive before 2:44pm
And result a 1 - if they depart after 2:46pm

Suggestions?
This comment was minimized by the moderator on the site
Hello,

This is a great article and the OR(MOD... is a great work around for times on different dates.

How would I incorporate this to a formula with the following parameters:

If Cell A1 reads as yesterday between 22:00 and 23:59, display as same day.
If Cell A1 reads as today between 00:00 and 21:59, display as yesterday.

Any assistance here is GREATLY appreciated as I'm a lost little puppy on this one.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Ik hoop dat iemand mij hier kan helpen.
Ik heb zoals de meeste mensen in deze discussie, een tijdvenster bestaande uit 2 tijden.
voor het gemak:
Cel A2 staat in 15:00
Cel B2 staat in 16:00
Cel C2 staat in 15:49

ik wil met een formule weten of Cel C2 binnen het tijdvak van A2 en B2 ligt.
als ik de formules kopieer van hierboven en deze aanpas naar mijn cellen(en taal), krijg ik een onjuiste formule melding.

Ik ben vrij handig in Excel... maar dit krijg ik verdorie niet voor elkaar.
(Ik heb een nederlandse versie van Excel)

de formule die ik nu probeerde te gebruiken is: =als(en(C2>=MIN(A2:B2),C2<=MAX(A2:B2)),"YES","NO")

wat doe ik fout? :(
This comment was minimized by the moderator on the site
Hello, Bastiaan
I have tested your formula in Dutch, the formula works well, please see the below screenshot:
https://www.extendoffice.com/images/stories/comments/comment-skyyang/doc-check-time-1.png
Please try again, thank you!
This comment was minimized by the moderator on the site
Hi, I am comparing hundreds of thousands of lines of data (for the first time) and needed an equation that that compares time between two of he columns. However, I cannot get away with an IF statement using A3<>F3 because the times in A3 are about 1 second off. Rather I just need to the nearest minute. Any help?
This comment was minimized by the moderator on the site
I am in need of assistance. I have been pulling my hair out over the last month trying to figure out a way to make my life simpler. I am not even sure if it can be done because I can not find anything on how to do it. My problem is this........ I recently started using a new program to collect data for incoming and outgoing employees. The data readers are sensitive and will sometimes account for an employee multiple times over the course of a couple of minutes. when I export this data into an excel file, it is an absolute nightmare trying to individually delete the extra captures. Using the remove duplicates option helps, but still leaves many duplicate times due to the Seconds in the time being different. Today for example after I removed the duplicates, I still have over 24,000 unique entries that I have to go through to get that data I need. Someone, anyone..... please Help!
This comment was minimized by the moderator on the site
I am trying to calculate time per day for example I went to the computer lab and logged in for 4hours&35minutes on Monday and Tuesday I logged in on for 2 hours and 10 minutes and Wednesday 3hours and 4 minutes and Thursday for 4 hours and 14 minutes and Friday 1 hour and 15 minutes. Add those total together and get a grand total. I want to be able to keep every minute. No rounding, I know that I have to use the IF function.
This comment was minimized by the moderator on the site
Help me in this, as if there is some time ranges in a day and i have to find out time clashing is there or not. then please suggest some formula!
This comment was minimized by the moderator on the site
Hello I have to find my specific time is in between two times...eg : Start time(AS2) is 23:00:00 and End time(AT2) is 8:00:00, specific time(J2) is 0:02:20, so when i use the formula =IF(AND(J2>=MIN(AS2:AT2),J2<=MAX(AS2:AT2)),"YES","NO") it should show yes as its in between tow times only but its showing no, any help in correcting the formula ?
This comment was minimized by the moderator on the site
Hi Santosh, That is similar to my use,I use something along the lines of;

=IF(AND(C2>=MIN("13:00"),C2<=MAX("13:10")),"YES","NO")
This comment was minimized by the moderator on the site
Hi Silver,


The formula doesn't work. If I have to enter "13:00" (hours) in each row, why there is formula, this is not making the job any easier.
This comment was minimized by the moderator on the site
If your time over midnight, you should apply the below formula:
=OR(MOD(C1,1)>TIME(23,0,0),MOD(C1,1)<TIME(8,0,0))
This comment was minimized by the moderator on the site
In the above formula, C1 is the specific time you want to check for, and the TIME(23,0,0) and TIME(8,0,0) are the two times you want to check between. You should change the references to your need.
Please try it, hope it can help you!
This comment was minimized by the moderator on the site
I have two times here 23:00:00(AS2 Start Time) and 8:00:00(AT2 End Time) and specific time is 0:02:20(J2), so when i use this formula =IF(AND(J2>=MIN(AS2:AT2),J2<=MAX(AS2:AT2)),"YES","NO"), it should come as yes as the specific time is in between our two start and end time but its showing no..any help in correcting this formula
This comment was minimized by the moderator on the site
This isn't working for me when the specific time is =NOW() to display the current time. Any suggestions?
This comment was minimized by the moderator on the site
Hello, Nikkii,

If you enter =now() function to get the current date and time, both date and time are displayed, if you need a formula to get the current time dynamically, you can apply this formula: =MOD(NOW(),1), and then format it as time format. And then, you can use the formula in this article successfully.

Please try, hope it can help you!
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