我有此数据(如下所示),我想知道如何确定00:00:00-00:59:59
之间,然后是01:00:00-1:59:59
等之间有多少个条目。因此,实际上并未考虑日期,这只是时间。
id | date
1 | 2018-11-08 01:40:49
2 | 2018-11-08 04:08:12
3 | 2018-11-25 15:19:44
4 | 2018-12-14 01:34:01
CSV版本:
id,date
1,2018-11-08 01:40:49
2,2018-11-08 04:08:12
3,2018-11-25 15:19:44
4,2018-12-14 01:34:01
所以我的预期数据将是:
Start Period | End Period | amount
00:00:00 | 00:59:59 | 0
01:00:00 | 01:59:59 | 2
02:00:00 | 02:59:59 | 0
03:00:00 | 03:59:59 | 0
04:00:00 | 04:59:59 | 1
05:00:00 | 05:59:59 | 0
...
And so on
CSV版本:
Start Period,End Period,amount
00:00:00,00:59:59,something here
00:01:00,01:59:59,something here
00:02:00,02:59:59,something here
00:03:00,03:59:59,something here
00:04:00,04:59:59,something here
00:05:00,05:59:59,something here
00:06:00,06:59:59,something here
00:07:00,07:59:59,something here
00:08:00,08:59:59,something here
00:09:00,09:59:59,something here
00:10:00,10:59:59,something here
00:11:00,11:59:59,something here
00:12:00,12:59:59,something here
00:13:00,13:59:59,something here
00:14:00,14:59:59,something here
00:15:00,15:59:59,something here
00:16:00,16:59:59,something here
00:17:00,17:59:59,something here
00:18:00,18:59:59,something here
00:19:00,19:59:59,something here
00:20:00,20:59:59,something here
00:21:00,21:59:59,something here
00:22:00,22:59:59,something here
00:23:00,23:59:59,something here
答案 0 :(得分:1)
您还可以尝试将以下sumproduct
函数与嵌入式hour
函数一起使用:
= SUMPRODUCT(-(HOUR(日期范围)> = 开始时间段 * 24),-(HOUR(日期范围 )<结束时间 * 24))
确保仅选择日期范围,而不是整个列。
答案 1 :(得分:0)
如果日期在B列中,则将其放在金额下并填写。
=SUMPRODUCT(--(HOUR(B$2:INDEX(B:B,MATCH(1E+99,B:B)))=(ROW(1:1)-1)))