我有原始数据,每月有人多次出现,超过一个月。我想知道连续几个月(可以追溯到今天)该人的值是0.如何为此编写公式?
COUNTIF(s)A2中的人员在RAWDATA中找到,并且原始数据中的分数列的值为零,并且从今天开始计算的数量为零,并且#34;
A人在5月,4月,3月和2月的得分为零,所以结果应为4(从最大日期开始算起)
Name Date Score
Person A 1/10/2017 1
Person A 1/20/2017 1
Person A 1/30/2017 1
Person A 1/31/2017 1
Person A 2/10/2017 1
Person A 2/20/2017 0
Person A 2/24/2017 1
Person A 2/28/2017 0
Person A 3/10/2017 1
Person A 3/20/2017 1
Person A 3/31/2017 0
Person A 2017-04-31 0
Person A 4/10/2017 1
Person A 4/20/2017 1
Person A 4/28/2017 1
Person A 5/28/2017 0
Person A 5/10/2017 1
Person A 5/26/2017 1
Person A 5/10/2017 1
Person A 5/19/2017 1
Person A 5/30/2017 1
Person A 11/3/2016 1
Person A 11/11/2016 0
Person A 11/22/2016 1
Person A 12/9/2016 1
Person A 12/9/2016 1
Person A 12/19/2016 1
Person A 12/16/2016 1
Person A 2/10/2017 N/A
Person A 2/20/2017 1
Person A 2/24/2017 1
Person A 3/10/2017 1
Person A 3/20/2017 1
Person A 3/28/2017 N/A
Person A 4/20/2017 N/A
Person A 4/25/2017 N/A
Person A 5/30/2017 N/A
Person A 11/28/2016 N/A
Person A 12/6/2016 1
答案 0 :(得分:1)
绝对非常棘手。
我建议的解决方案是:
(a) Find the date D1 of the latest zero score
(b) Going back month by month from D1, find the latest month which does not contain a zero score.
(a)很简单 - 使用汇总来查找人A得分为零的最新日期
=AGGREGATE(14,6,RawData!$C$2:$C$100/((RawData!$A$2:$A$100=$A$2)*(RawData!$D$2:$D$100=0)),1)
(b)更难。我不得不开发一个数月的数组,然后使用COUNTIFS来查看每个月A人的零分数下降,然后使用MATCH查看最近一个月没有零分数。所以如果你想回去一年说
=MATCH(0,COUNTIFS(RawData!$C$2:$C$100,"<"&DATE(YEAR($B2),MONTH($B2)-ROW($1:$12)+1,1),
RawData!$C$2:$C$100,">="&DATE(YEAR($B2),MONTH($B2)-ROW($1:$12),1),RawData!$A$2:$A100,$A2,RawData!$D$2:$D$100,0),0)
使用 Ctrl Shift 输入作为数组公式输入。
请注意,我的日期在C栏,因为我必须将它们转换为dd-mm-yyyy,我的分数在D栏。