简体   繁体   English

Excel 基于另一个单元格的过滤器公式如果为空则获取任何

[英]Excel Filter Formula based on another cell get any if empty

So I'm trying to get this sorted out for a while but can't seem to figure it out.所以我想暂时解决这个问题,但似乎无法弄清楚。

I am using the FILTER formula in order to filter a set of records in a table based on the value of a cell (actually multiple conditions, but nos really the point).我正在使用 FILTER 公式,以便根据单元格的值过滤表中的一组记录(实际上是多个条件,但不是重点)。 The thing is, I would like the formula to filter the records if the condition cell has some text, but if it is empty, I would like it to return ALL records as if there was no filter, and I can't get it right...问题是,如果条件单元格有一些文本,我希望公式过滤记录,但如果它是空的,我希望它返回所有记录,就好像没有过滤器一样,但我做对了...

This is the formula I am using:这是我使用的公式:

=FILTER(Table;SI(D2<>"";Table[Streaming]=D2;Table[Streaming]=""))

Any clues?有什么线索吗?

Thanks谢谢

Nesting formulas is powerful, when the syntax of the formula is well understood.当公式的语法很好理解时,嵌套公式非常强大。 In the screenshot, this formula filters the table:在屏幕截图中,此公式筛选表格:

=FILTER(Table1,(IF(H2="",TRUE,Table1[Color]=H2))*(IF(H3="",TRUE,Table1[size]=H3))*(IF(H4="",TRUE,Table1[length]=H4)))

在此处输入图像描述

在此处输入图像描述

In case you want to duplicate the whole table if there are no filters specified, then wrap the above formula into an IfErrror() like this:如果你想在没有指定过滤器的情况下复制整个表,那么将上面的公式包装到 IfErrror() 中,如下所示:

=IFERROR(FILTER(Table1,IF(H2="",TRUE,Table1[Color]=H2)*IF(H3="",TRUE,Table1[size]=H3)*IF(H4="",TRUE,Table1[length]=H4)*(COUNTA(H2:H4)>1)),Table1)

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

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