Excel - Array Formula to skip empty cells

浪尽此生 提交于 2019-11-29 10:58:04

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:

Which version of Excel are you using?

In Excel 2007 or later try this version

=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

confirmed with CTRL+SHIFT+ENTER

In earlier versions where IFERROR function is not available, you can use this version

=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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!