[英]Filter items based on another column value with result in one cell
I have table like this in excel: 我在excel中有这样的表:
A B C ----------- 1| a t 2| b 3| c t 4| d 5| e t 6| f t
and want select all values in column A where value in column B is 't'. 并希望选择A列中的所有值,其中B列中的值为“ t”。 There is no problem to select them with matrix formula like this:
像这样用矩阵公式选择它们是没有问题的:
=JEŻELI.BŁĄD(INDEKS(A1:A10;MIN.K(JEŻELI(B1:B10="t";WIERSZ(B1:B10);"");WIERSZ()));"")
but the problem is that I want send the result to one cell only (example result based on above table): 但问题是我只想将结果发送到一个单元格(基于上表的示例结果):
"a,c,e,f"
It is possible without writing a VBA code? 是否可以不编写VBA代码?
If you have Office 365 Excel you can use TEXTJOIN as an array formula: 如果您具有Office 365 Excel,则可以将TEXTJOIN用作数组公式:
=TEXTJOIN(",",TRUE,IF($B$1:$B$6 = "t",$A$1:$A$6,""))
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when Exiting edit mode. 作为数组公式,退出编辑模式时必须使用Ctrl-Shift-Enter而不是Enter进行确认。 If done correctly then Excel will put
{}
around the formula. 如果操作正确,则Excel会将
{}
放在公式周围。
If you do not have Office 365 Excel or do not want to us an array formula then you will need a helper column. 如果您没有Office 365 Excel或不想给我们一个数组公式,则需要一个帮助器列。
In C1 put: 在C1中放:
=IF(B1="t",A1&"," &C2,C2)
And copy down the length of the dataset. 并复制数据集的长度。
Then in D1 put: 然后在D1中放入:
=LEFT(C1,LEN(C1)-1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.