简体   繁体   English

Excel - 用于跳过空单元格的数组公式

[英]Excel - Array Formula to skip empty cells

I have an array formula to fill in the cell when it contains text but I want it to ignore the cell if its blank and go to the next one. 我有一个数组公式,当它包含文本时填充单元格,但我希望它忽略单元格,如果它的空白,然后转到下一个单元格。 The issue I am having is that it does not do it in the order i have for example: 我遇到的问题是,它没有按照我的顺序执行:

Range is 范围是

-A
-(BLANK CELL)
-(BLANK CELL)
-D
-E
-F
-(BLANK CELL)
-H
-(BLANK CELL)

Result from the formula 公式的结果

-A
-E
-F
-H

It is skipping the cells that contain letters. 它正在跳过包含字母的单元格。 CAN SOMEONE HELP?? 有人可以提供帮助吗?

FORMULA: 式:

{=IF(ISERROR(SMALL(IF(B4:$B$12<>"",ROW(B4:$B$12)),ROW(B4:$B$12)-3)),"",INDEX(B4:$B$12,MATCH(SMALL(IF(B4:$B$12<>"",ROW(B4:$B$12)),ROW(B4:$B$12)-3),IF(B4:$B$12<>"",ROW(B4:$B$12)),0)))}

I think the problem is that you have the range as B4:$B$12 , so because there are no $ signs around B4 that reference changes as you drag the formula down the column.......but the formula looks a little more complex than you need so I'd rather suggest a better alternative: 我认为问题在于你的范围为B4:$B$12 ,因为B4周围没有$符号,当你将公式拖到列.......但公式看起来有点时,引用会发生变化比你需要的更复杂,所以我宁愿建议一个更好的选择:

Which version of Excel are you using? 您使用的是哪个版本的Excel?

In Excel 2007 or later try this version 在Excel 2007或更高版本中尝试此版本

=IFERROR(INDEX(B$4:B$12,SMALL(IF(B$4:B$12<>"",ROW(B$4:B$12)-ROW(B$4)+1),ROWS(D$4:D4))),"")

Assumes your first cell is D4 (change ROWS(D$4:D4) part to match your actual start cell) and you are dragging the formula down the column 假设您的第一个单元格是D4 (更改ROWS(D$4:D4)部分以匹配您的实际起始单元格)并且您将公式拖到列中

confirmed with CTRL + SHIFT + ENTER CTRL + SHIFT + ENTER确认

In earlier versions where IFERROR function is not available, you can use this version IFERROR功能不可用的早期版本中,您可以使用此版本

=IF(ROWS(D$4:D4)>COUNTA(B$4:B$12),"",INDEX(B$4:B$12,SMALL(IF(B$4:B$12<>"",ROW(B$4:B$12)-ROW(B$4)+1),ROWS(D$4:D4))))

Found a simpler and easier way, basically Excel considers all blank cells ( "" ) equal, so another easy way is to select the column that contains the data and click on Remove Duplicates under the Data tab, this will remove (skip) all of the blank empty cells. 找到一种更简单,更简单的方法,基本上Excel认为所有空单元格( "" )相等,所以另一种简单的方法是选择包含数据的列,然后单击Data选项卡下的Remove Duplicates ,这将删除(跳过)所有空白的空单元格。

从Excel中删除空白单元格的简单方法 - 作者:Francis Lacle

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

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