仅显示具有值的单元格并移除空白行的公式 [英] Formula to show only cells with a value and remove blank rows
问题描述
我有一个两列宽的列表,其中有空行,我试图制作第二个列表,只显示列B中的文本行,如果列C也有相同的值时间去除空白行。例如这里是我的列表:
您可以使用以下内容:
对于项目: = IFERROR(INDEX(G $ 1:G $ 5,SMALL(IF $ 1:H $ 5';> 中,ROW(G $ 1:G $ 5)-ROW(G $ 1)+1), ROWS(G $ 1:G1)),)
对于数量: = IFERROR(INDEX H $ 1:H $ 5,体积(IF(H $ 1:H $ 5';> 中,ROW(G $ 1:G $ 5)-ROW(G $ 1)+1),行(G $ 1:G1))), )
以下是我如何设置数据的屏幕截图,因此您可以调整这些公式中的范围:
这是Item的公式。获取号码的唯一更改是将中的列更改为
code> H $ 1:H $ 5 。 G $ 1:G $ 5
到
输入这些公式作为数组公式( CTRL + SHIFT + ENTER )
如果您放置这些公式并向下拖动一列,您可以动态更新表,因为ID被添加到项目旁边:
而且,只要FYI如果要反转结果,只需更改 Small
到大
在公式中。
I have a list that's two columns wide that has blank rows in then I'm trying to make a second list that shows only the rows with text in column "B" if column "C" also has a value at the same time removing the blank rows. For example here's my list:
sheet 1 is my list and list 2 is how I would like it to look.
I'm correctly using this formula:
=IF(ROWS($B$4:B4)>COUNTA($B$4:$B$13),"",INDEX($B$4:$B$13,AGGREGATE(15,6,(ROW($B$4:$B$13)-ROW($B$4)+1)/($B$4:$B$13<>""),ROWS($B$4:B4))))
which removed the blank rows but it shows black cells in column "C" for example:
You can use the following:
For the Item: =IFERROR(INDEX(G$1:G$5,SMALL(IF(H$1:H$5<>"",ROW(G$1:G$5)-ROW(G$1)+1),ROWS(G$1:G1))),"")
For the Qty: =IFERROR(INDEX(H$1:H$5,SMALL(IF(H$1:H$5<>"",ROW(G$1:G$5)-ROW(G$1)+1),ROWS(G$1:G1))),"")
Here's a screenshot of how I set up the data, so you can adjust the ranges in those formulas:
That's the formula for the Item. The only change to get the number, is change the column in the If
statement from G$1:G$5
to H$1:H$5
.
Enter these formulas as an array formula (CTRL+SHIFT+ENTER) If you put these formulas and drag down a column, you can get your table updated dynamically, as IDs are added next to the Items:
And, just FYI if you want to reverse the results, just change Small
to Large
in the formula.
这篇关于仅显示具有值的单元格并移除空白行的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!