简体   繁体   English

具有特定文本的行数

[英]Number of rows with specific text

How to get the number of rows which includes A, AA, AAA, AB, AAC etc.?如何获取包括 A、AA、AAA、AB、AAC 等在内的行数? On the following example result is 2. If the same row has A on different shapes on many cells it's only calculated as one.在以下示例中,结果为 2。如果同一行在许多单元格的不同形状上具有 A,则仅计算为一个。

Cell A1: AA, B1: A, A2: AAABABC, A3: BC单元格 A1:AA,B1:A,A2:AAABABC,A3:BC

The following only calculates if rows has one A but not rows with AA or AAA以下仅计算行是否有一个 A 但没有 AA 或 AAA 的行

=SUM(--(MMULT(--(A1:C10="A"); TRANSPOSE(COLUMN(A1:C10)))>0))

The following calculates how many A's one row has but not the amount of rows.下面计算 A 的一行有多少,但不计算行数。

=SUMPRODUCT((LEN($A1:$C10)-LEN(SUBSTITUTE($A1:$C10;"A";"")))/LEN(1))

If you just want to count how many rows contain at least one A, it should just be a slight alteration to your MMULT formula:如果您只想计算至少包含一个 A 的行数,则只需对您的 MMULT 公式稍作改动:

=SUM(--(MMULT(--(ISNUMBER(FIND("A",A1:C10))), TRANSPOSE(COLUMN(A1:C10)))>0))

entered as an Array formula using Ctrl Shift Enter .使用Ctrl Shift Enter作为数组公式输入。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM