Excel中的库存重建从唯一产品库存状态和时间戳列表中进行

时间:2015-04-18 08:53:56

标签: excel datetime count formula uniqueidentifier

id  status      date      time

a   received    01-Jan-14 04:00
a   available   05-Jan-14 05:00
a   returned    06-Jan-14 13:00
a   destroyed   07-Jan-14 12:00
b   received    10-Jan-14 14:00
b   available   11-Jan-14 08:00
b   returned    12-Jan-14 09:00
b   destroyed   13-Jan-14 07:00
c   received    02-Jan-14 05:00
c   available   03-Jan-14 07:00
c   returned    05-Jan-14 08:00
d   received    09-Jan-14 02:00
d   available   12-Jan-14 06:00
(etc)

我有唯一的id个,每个都有statusdatetime。对于给定的日期/时间,我需要计算available个。对于给定的日期/时间,我需要计算received个。我打算在给定的单元格中输入日期和时间,并根据该日期和时间进行这些计数。

即。 January 3, 2014 06:00,已收到2 received0 available小部件[a,但尚未提供;已收到c但尚未提供]。

如何将其作为Excel公式执行?

1 个答案:

答案 0 :(得分:0)

假设01=Jan-14采用日期格式且在C2中,F1包含January 3, 2014 06:00的日期格式,available始终与received配对,并紧随其后,并且您拥有在E2中连接并复制下来:

=C2+D2  

然后对于available,请尝试:

=COUNTIFS(B2:B100,"received",E2:E100,"<"&F1,B3:B101,"available",E3:E101,"<"&F1)  

received

=COUNTIFS(B:B,"received",E:E,"<"&F1)  

前者的范围超出Rows100 / 101以适应。