计算Excel行中的当前条纹 [英] Calculate current streak in Excel row

查看:43
本文介绍了计算Excel行中的当前条纹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在excel行中有一个1和0的列表,范围是B2:K2,我想计算单元格M2中1的当前条纹,

I have a list of 1s and 0s in excel row ranging from B2:K2, I want to calculate the current streak of 1's in cell M2,

条纹为4的示例数据集

1 0 1 0 1 1 1 1 0

有没有简单的方法可以做到这一点?我曾尝试研究,但未能找到任何具体的东西.

Is there a simple way of doing this? I have tried research but not been able to find anything specific.

任何帮助将不胜感激.

推荐答案

这里是一种仅使用一个公式即可完成此操作的方法,无需使用辅助列/行:

Here is a way of doing this with just one formula, no helper columns/rows needed:

所用公式转换为:

{=MAX(FREQUENCY(IF(B1:K1=1,COLUMN(B1:K1)),IF(B1:K1=1,0,COLUMN(B1:K1))))}

注意:这是一个数组公式,应通过 Ctrl Shift Enter

Note: It's an array formula and should be entered through CtrlShiftEnter

这篇关于计算Excel行中的当前条纹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆