简体   繁体   English

根据另一个列值过滤项目,结果在一个单元格中

[英]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.

相关问题 根据另一列中的单元格值验证一列中的单元格值 - Validate cell value in one column based on cell value in another column 根据另一列中的值将值复制到一个单元格中 - Copy value down one cell based on value in another column 将一列中的值除以另一列并根据另一个单元格设置值 - Dividing values in one column with another column and setting value based on another cell 有没有办法根据另一列中的一个单元格扫描整个列并提取相应列的值? - Is there a way to scan an entire column based on one cell in another column and pull out a value of the corresponding column? 根据另一列中的单元格值命名工作表 - Name worksheets based on cell value in another column 根据另一个单元格值更改列宽 - Change column width based on another cell value 根据另一个单元格的值将数据从一个单元格复制到另一个单元格 - Copying data from one cell to another based on the value of another cell Excel 根据另一列中的值筛选列表 - Excel filter a list based on a value in another column Excel VBA 根据第二列单元格值将列从一张表复制到另一张表 - Excel VBA to Copy Column from one sheet to another based on a second columns cell value 是否可以基于另一个单元格中的值有条件地使用数据条格式化一个单元格? - Is it possible to conditionally format one cell with a databar based on a value in another cell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM