简体   繁体   English

如何使用跳过的行在 Google 表格中保持运行计数?

[英]How do I keep a running count in Google Sheets with skipped lines?

I have a Google Sheet that looks like this:我有一个看起来像这样的谷歌表:

A           |
Group 1     |
Lorem       |
Ipsum       |
Dolor       |
null        |
Group 2     |
Sit         |
Amet        | 
Consectetur |

I would like to create a new column (preferably in column A) that keeps a running count of entries, skipping the blank rows ("null"), and skipping the Group headers.我想创建一个新列(最好在 A 列中),以保持条目的运行计数,跳过空白行(“null”)并跳过组标题。

A     | B
null  | Group 1 
1     | Lorem 
2     | Ipsum 
3     | Dolor 
null  | null   
null  | Group 2 
4     | Sit 
5     | Amet  
6     | Consectetur 

If an entry is added or deleted, then the desired output would automatically update the numbering.如果添加或删除条目,则所需的输出将自动更新编号。

try:尝试:

=ARRAYFORMULA(IF((B:B="")+(REGEXMATCH(B:B, "Group")),,
 MMULT(TRANSPOSE((ROW(B:B)<=TRANSPOSE(ROW(B:B)))*
              IF((B:B="")+(REGEXMATCH(B:B, "Group")),,1)), 
         SIGN(IF((B:B="")+(REGEXMATCH(B:B, "Group")),,1)))))

0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Google工作表中执行If Else? - How to do an If Else in google sheets? 如何依次填充Google表格中的大量单元格? - How do I sequentially fill a big range of cells in Google Sheets? 如何忽略此 SUM 中的 N/A 值? (谷歌表格) - How do I ignore N/A values in this SUM? (Google Sheets) 如何获取两张工作表之间一行中不匹配单元格的数量? - How do I get the count of non matching cells in a row between two sheets? 计数如果“是”Google 表格条件 - Count if "Yes" Google Sheets condition 突出显示部分公式时如何启用谷歌表格值气泡 - How do I enable google sheets value bubbles when highlighting portions of formulas 如何根据 Google 表格中的多个条件返回 true 或 false? - How do I return a true or false based on multiple criteria in Google sheets? 谷歌表,我如何让正则表达式匹配在列表中查找文本字符串? - Google sheets, how do I get regexmatch to find a text string in a list? 在谷歌表格中,我如何将一系列数字中的正差加到 10? - In google sheets how do I sum the positive difference to 10 in a range of numbers? 如何使用基于 Google 表格中的列表的 2 层数据验证来切换黑白查询 - How do I switch b/w queries using 2 tiered data validation based on lists in Google Sheets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM