列出从一行中填充 4 个单元格中的 2 个的行数
Listing the number of rows with 2 of 4 cells filled from a row
想象一下我有一个像这样的 sheet
People Alpha Bravo Charlie Delta Echo Foxtrot
p1 x x
p2 x x x
p3 x x x
等
我如何制作一个函数来打印参加以下两项活动的人数:Alpha、Charlie、Echo 和 Foxtrot
又名这些排列之一:
空调,
一个&E,
一个&F,
C&E,
C&F,
E & F
标题
如果单元格值为x
:
=((B2="x")+(D2="x")+(F2="x")+(G2="x"))=2
如果单元格值为复选框(TRUE
):
=(B2+D2+F2+G2)=2
尝试:
=INDEX(QUERY(SPLIT(FLATTEN(IF(B2:G = "x"; A2:A&"♥"&B1:G1; )); "♥");
"where Col2 is not null"; ))
更新 1:
=SUMPRODUCT((B2:B16<>"")*(E2:E16<>""))
更新 2:
=QUERY(INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE({
IF(B2:C="",,B1:C1&","),
IF(REGEXMATCH(D2:D, "- D2$"), D1&"2,", IF(D2:D="",,D1&",")),
IF({E2:E, G2:K, M2:O}="",,{E1, G1:K1, M1:O1}&","),
IF(REGEXMATCH(P2:P, "- Z$"), P1&",", ),
IF(Q2:Q="",,Q1&",")}),,9^9))), ",$", )),
"select Col1,count(Col1) where Col1 is not null group by Col1
order by count(Col1) desc label count(Col1)''")
想象一下我有一个像这样的 sheet
People Alpha Bravo Charlie Delta Echo Foxtrot
p1 x x
p2 x x x
p3 x x x
等 我如何制作一个函数来打印参加以下两项活动的人数:Alpha、Charlie、Echo 和 Foxtrot
又名这些排列之一: 空调, 一个&E, 一个&F, C&E, C&F, E & F
标题
如果单元格值为x
:
=((B2="x")+(D2="x")+(F2="x")+(G2="x"))=2
如果单元格值为复选框(TRUE
):
=(B2+D2+F2+G2)=2
尝试:
=INDEX(QUERY(SPLIT(FLATTEN(IF(B2:G = "x"; A2:A&"♥"&B1:G1; )); "♥");
"where Col2 is not null"; ))
更新 1:
=SUMPRODUCT((B2:B16<>"")*(E2:E16<>""))
更新 2:
=QUERY(INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE({
IF(B2:C="",,B1:C1&","),
IF(REGEXMATCH(D2:D, "- D2$"), D1&"2,", IF(D2:D="",,D1&",")),
IF({E2:E, G2:K, M2:O}="",,{E1, G1:K1, M1:O1}&","),
IF(REGEXMATCH(P2:P, "- Z$"), P1&",", ),
IF(Q2:Q="",,Q1&",")}),,9^9))), ",$", )),
"select Col1,count(Col1) where Col1 is not null group by Col1
order by count(Col1) desc label count(Col1)''")