我有一个电子表格,其中一列包含一个人的体重。我想计算当前体重和所有时间的连续条目中它们的体重连续减少了多少次,所以:
108
107
106
105
104
106
104
103
应在结束时连续减少3次,返回3;在开始时连续减少5次,则返回5。这些值在工作表中的列中而不是行中。我该怎么做?
答案 0 :(得分:2)
粘贴在 D2 单元格中:
=ARRAYFORMULA(IF(LEN({A2; A2:A}), IF(B2:B901 < {1000; B2:B900}, 1, ), ))
粘贴在 E2 单元格中:
=ARRAYFORMULA(IF(D2:D901=1,
MMULT(N(ROW(D2:D901)>=TRANSPOSE(ROW(D2:D901))), N(D2:D901=1))-HLOOKUP(0,
MMULT(N(ROW(D2:D901)> TRANSPOSE(ROW(D2:D901))), N(D2:D901=1)), MATCH(
VLOOKUP(ROW(D2:D901), IF(N(D2:D901<>D1:D900), ROW(D2:D901), ), 1, 1),
VLOOKUP(ROW(D2:D901), IF(N(D2:D901<>D1:D900), ROW(D2:D901), ), 1, 1), 0), 0), ))
并确保您的工作表最少包含901行
答案 1 :(得分:0)
我设法在没有帮助者列的情况下进行了当前的连胜,它还计算了连胜的持续天数(这不是我要的,但对我来说更好)。不确定在这里回答我自己的问题是否是正确的答案,我对此网站没有经验。
=iferror(sum(query(query({Log!A2:A, ArrayFormula(if(len(Log!A2:A), if(row(Log!A2:A) > 2, Log!A2:A - offset(Log!A2:A, -1,,counta(Log!A2:A)+1 ),0 ), )), ArrayFormula(if(len(Log!A2:A), if(row(Log!A2:A) > 2, if(len(Log!B2:B), Log!B2:B < offset(Log!B2:B, -1,,counta(Log!B2:B)+1 ), true),TRUE ), )), Log!B2:B}, "select * where Col1 is not null order by Col1 desc limit " & match(False, query(query({Log!A2:A, ArrayFormula(if(len(Log!A2:A), if(row(Log!A2:A) > 2, Log!A2:A - offset(Log!A2:A, -1,,counta(Log!A2:A)+1 ),0 ), )), ArrayFormula(if(len(Log!A2:A), if(row(Log!A2:A) > 2, if(len(Log!B2:B), Log!B2:B < offset(Log!B2:B, -1,,counta(Log!B2:B)+1 ), true),TRUE ), )), Log!B2:B}, "select * where Col1 is not null order by Col1 desc"), "select Col3"), 0)-1), "select Col2")), 0)
并计算最大条纹:
=max(transpose(index(query({0}, "select " & join(",", unique(transpose(split(substitute(join(" + ", query({Log!A2:A, ArrayFormula(if(len(Log!A2:A), if(row(Log!A2:A) > 2, if(Log!B2:B < offset(Log!B2:B, -1,,counta(Log!B2:B)+1,), Log!A2:A - offset(Log!A2:A, -1,,counta(Log!A2:A)+1 ), 0),0 ), )), ArrayFormula(if(len(Log!A2:A), if(row(Log!A2:A) > 2, if(len(Log!B2:B), Log!B2:B < offset(Log!B2:B, -1,,counta(Log!B2:B)+1 ), false),false ), )), Log!B2:B}, "select Col2 where Col1 is not null order by Col1 desc")), " + 0 + ", ","), ","))))), 2)))