问题描述
这对我来说似乎是一个微不足道的问题,但我无法正确完成。部分数据集看起来像这样
1,1,1,0,0,1,1,1,1,1 ,0,0,0
并包含两个运行1(不确定这是否正确),一个长度为3,另一个长度为5。
如何使用Google文档或类似的电子表格应用程序来查找最长的那些运行?
在Excel中,您可以使用单个公式来获取连续1的最大数量,即$ b $ (A2:A100 = 1,ROW(A2:A100)),IF(A2:A100≠1,ROW(A2:A100) ))))
用CTRL + SHIFT + ENTER确认
在googledocs您可以使用相同的公式,但包装在arrayformula而不是使用CSE,即
$ b
= arrayformula(MAX(FREQUENCY(IF(A2:A100 = 1,ROW(A2:A100)),IF(A2:A100≠1,ROW(A2:A100)))))
This seemed like a trivial question to me, but I cannot get it done correctly. Part of my dataset looks like this
1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0
and contains two "runs" of 1 (not sure if that’s the correct word), one with a length 3, the other with a length of 5.
How can I use Google Docs or similar spreadsheet applications to find the longest of those runs?
In Excel you can use a single formula to get the maximum number of consecutive 1s, i.e.
=MAX(FREQUENCY(IF(A2:A100=1,ROW(A2:A100)),IF(A2:A100<>1,ROW(A2:A100))))
confirmed with CTRL+SHIFT+ENTER
In googledocs you can use the same formula but wrap in arrayformula rather than use CSE, i.e.
=arrayformula(MAX(FREQUENCY(IF(A2:A100=1,ROW(A2:A100)),IF(A2:A100<>1,ROW(A2:A100)))))
Assumes data in A2:A100 without blanks
这篇关于在一个电子表格(GDocs或类似的)中,我如何找出最长的一个数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!