确定给定时间是否在多个时间范围之间

问题描述 投票:0回答:1

我正在尝试使用一个公式来确定给定时间(测试“C2”)是否位于多个时间范围(尝试“B:C”)之间。

使用:

=IF(C2>=ATTEMPTS!$B$2,IF(C2<=ATTEMPTS!$C$2, "In Range", "Out of Range"), "Out of Range")

我可以确定测试#1(测试“A2:D2”)是否在尝试#1(ATTEMPTS“A2:D2”)范围内,但需要针对与其 ID 号对应的每个尝试运行测试#1

尝试

测试

我觉得这可以通过 INDEX 和 MATCH 的某种组合来完成,但我无法找到一种方法来编写该公式来实现我想要的目标。

谢谢!

excel excel-formula time
1个回答
0
投票

如果您想使用动态数组来实现,可以使用以下公式:

= LET( tests,             A2:D11,
       attempts,          A2:D13,
       attempts_ids,      INDEX(attempts,, 1),
       attempts_starts,   INDEX(attempts,, 2),
       attempts_ends,     INDEX(attempts,, 3),
       check_func,        LAMBDA( tests_row,
                                  LET( tests_ids,  INDEX(tests_row,, 1),
                                       tests_time, INDEX(tests_row,, 3),
                                       IF( SUM( (tests_time >= attempts_starts) *
                                                (tests_time <= attempts_ends) *
                                                (tests_ids = attempts_ids) ) > 0,
                                           "In Range",
                                           "Out Range")
                                     )),
       check_result,      BYROW(tests, check_func),
       check_result
     )

您只需将其放在

E2
处,然后就可以使用公式的前两个参数(表格)
tests
attempts
tests
应该是您的 TEST 表范围
(A2:D11)
attempts
应该是您的 ATTEMPTS 表范围
(A2:D13)

© www.soinside.com 2019 - 2024. All rights reserved.