Countifs in Google Sheets with various 'different than' criteria in the same row adds +1 value
Countifs in Google Sheets with various 'different than' criteria in same row adds +1 value
我正在尝试计算通过 google 表单提供的 Google sheet 同一行中与某些特定条件不同的所有值,但最终计数显示“1”。
我从中计算的行对应于具有 'other' 选项的多项选择题,因此用户可以输入其他值,我正在尝试计算 'other' 值的数量在行中。
我尝试了正常计数和 couldif,但是当你使用 <> 时,如果你想检查 B2:B 范围(B1 是标题),它最终会计数到无限,所以我使用了这样的结构:
=COUNTIFS(query('FORMS RESPONSES'!B2:B,"<>TYPE A"),
query('FORMS RESPONSES'!B2:B,"<>TYPE B"),
query('FORMS RESPONSES'!B2:B,"<>TYPE C"),
query('FORMS RESPONSES'!B2:B,"<>TYPE D"),
query('FORMS RESPONSES'!B2:B,"<>TYPE E"),
)
假设提要对 A、B、C 有 1 个响应,对 D、E 和其他 2 个具有随机值的条目有 none,答案应该是 = 2,但它只给我 = 1
我有这个:
=COUNTIFS(
query(datos!B2:B,"<>PC Tipo 1 (HP)")
,query(datos!B2:B,"<>PC Tipo 2 (Lenovo)")
,query(datos!B2:B,"<>PC Tipo 3 (Dell)")
,query(datos!B2:B,"<>Laptop Tipo 1 (Lenovo)")
,query(datos!B2:B,"<>Laptop Tipo 2 (Thinkpad)")
,query(datos!B2:B,"<>Tel Cel.")
)
VG:
B2:B 的示例数据条目为:
- PC Tipo 1(HP)
- PC Tipo 2(联想)
- PC Tipo 3(戴尔)
- 笔记本电脑 Tipo 1(联想)
- 服务器血量
- 投影仪
所以总共有 6 个条目,其中 2 个是我要计算的 'other' 类型(服务器 HP 和投影仪)。然而结果给了我 =1
你得到 1
作为一个错误计数。这样做:
=COUNTA(QUERY(datos!B2:B, "where not B contains 'PC Tipo 1 (HP)'
and not B contains 'PC Tipo 2 (Lenovo)'
and not B contains 'PC Tipo 3 (Dell)'
and not B contains 'Laptop Tipo 1 (Lenovo)'
and not B contains 'Laptop Tipo 2 (Thinkpad)'
and not B contains 'Tel Cel.'", 0))
或者您可以这样做:
=ARRAYFORMULA(COUNTA(datos!B2:B)-
SUM(COUNTIF(datos!B2:B, {"PC Tipo 1 (HP)",
"PC Tipo 2 (Lenovo)",
"PC Tipo 3 (Dell)",
"Laptop Tipo 1 (Lenovo)",
"Laptop Tipo 2 (Thinkpad)",
"Tel Cel."})))
(我只是通过重新发布答案来补充答案,而没有删除它的 'T.Y.'')
两个答案都很好。使用哪一个取决于您需要结果的位置。因为我不需要第一行或第二行的答案(我有 c20 之类的)所以我要使用这个版本:
=COUNTA(QUERY(datos!B2:B, "where not B contains 'PC Tipo 1 (HP)'
and not B contains 'PC Tipo 2 (Lenovo)'
and not B contains 'PC Tipo 3 (Dell)'
and not B contains 'Laptop Tipo 1 (Lenovo)'
and not B contains 'Laptop Tipo 2 (Thinkpad)'
and not B contains 'Tel Cel.'", 0))
如果您需要将它放在第一行并将其添加到标题中(如果您需要它作为来自 Google 表单的新回复自动出现在列表中,则另一个答案会更合适进来。如果有人需要知道怎么做,我用了这个:
={"Other responses"; ARRAYFORMULA(IF(LEN(A2:A),
(COUNTA(datos_equipos!B2:B)-
SUM(COUNTIF(datos_equipos!B2:B,
{"Escritorio - PC Tipo 1 (HP)",
"Escritorio - PC Tipo 2 (Lenovo)",
"Escritorio - PC Tipo 3 (Dell)",
"Laptop Tipo 1 (Lenovo)",
"Laptop Tipo 2 (Thinkpad)",
"Telefono Cel." }))) ,""))}
我正在尝试计算通过 google 表单提供的 Google sheet 同一行中与某些特定条件不同的所有值,但最终计数显示“1”。
我从中计算的行对应于具有 'other' 选项的多项选择题,因此用户可以输入其他值,我正在尝试计算 'other' 值的数量在行中。
我尝试了正常计数和 couldif,但是当你使用 <> 时,如果你想检查 B2:B 范围(B1 是标题),它最终会计数到无限,所以我使用了这样的结构:
=COUNTIFS(query('FORMS RESPONSES'!B2:B,"<>TYPE A"),
query('FORMS RESPONSES'!B2:B,"<>TYPE B"),
query('FORMS RESPONSES'!B2:B,"<>TYPE C"),
query('FORMS RESPONSES'!B2:B,"<>TYPE D"),
query('FORMS RESPONSES'!B2:B,"<>TYPE E"),
)
假设提要对 A、B、C 有 1 个响应,对 D、E 和其他 2 个具有随机值的条目有 none,答案应该是 = 2,但它只给我 = 1
我有这个:
=COUNTIFS(
query(datos!B2:B,"<>PC Tipo 1 (HP)")
,query(datos!B2:B,"<>PC Tipo 2 (Lenovo)")
,query(datos!B2:B,"<>PC Tipo 3 (Dell)")
,query(datos!B2:B,"<>Laptop Tipo 1 (Lenovo)")
,query(datos!B2:B,"<>Laptop Tipo 2 (Thinkpad)")
,query(datos!B2:B,"<>Tel Cel.")
)
VG:
B2:B 的示例数据条目为:
- PC Tipo 1(HP)
- PC Tipo 2(联想)
- PC Tipo 3(戴尔)
- 笔记本电脑 Tipo 1(联想)
- 服务器血量
- 投影仪
所以总共有 6 个条目,其中 2 个是我要计算的 'other' 类型(服务器 HP 和投影仪)。然而结果给了我 =1
你得到 1
作为一个错误计数。这样做:
=COUNTA(QUERY(datos!B2:B, "where not B contains 'PC Tipo 1 (HP)'
and not B contains 'PC Tipo 2 (Lenovo)'
and not B contains 'PC Tipo 3 (Dell)'
and not B contains 'Laptop Tipo 1 (Lenovo)'
and not B contains 'Laptop Tipo 2 (Thinkpad)'
and not B contains 'Tel Cel.'", 0))
或者您可以这样做:
=ARRAYFORMULA(COUNTA(datos!B2:B)-
SUM(COUNTIF(datos!B2:B, {"PC Tipo 1 (HP)",
"PC Tipo 2 (Lenovo)",
"PC Tipo 3 (Dell)",
"Laptop Tipo 1 (Lenovo)",
"Laptop Tipo 2 (Thinkpad)",
"Tel Cel."})))
(我只是通过重新发布答案来补充答案,而没有删除它的 'T.Y.'')
两个答案都很好。使用哪一个取决于您需要结果的位置。因为我不需要第一行或第二行的答案(我有 c20 之类的)所以我要使用这个版本:
=COUNTA(QUERY(datos!B2:B, "where not B contains 'PC Tipo 1 (HP)'
and not B contains 'PC Tipo 2 (Lenovo)'
and not B contains 'PC Tipo 3 (Dell)'
and not B contains 'Laptop Tipo 1 (Lenovo)'
and not B contains 'Laptop Tipo 2 (Thinkpad)'
and not B contains 'Tel Cel.'", 0))
如果您需要将它放在第一行并将其添加到标题中(如果您需要它作为来自 Google 表单的新回复自动出现在列表中,则另一个答案会更合适进来。如果有人需要知道怎么做,我用了这个:
={"Other responses"; ARRAYFORMULA(IF(LEN(A2:A),
(COUNTA(datos_equipos!B2:B)-
SUM(COUNTIF(datos_equipos!B2:B,
{"Escritorio - PC Tipo 1 (HP)",
"Escritorio - PC Tipo 2 (Lenovo)",
"Escritorio - PC Tipo 3 (Dell)",
"Laptop Tipo 1 (Lenovo)",
"Laptop Tipo 2 (Thinkpad)",
"Telefono Cel." }))) ,""))}