如何用前面的最后一个非空白单元格填充空白单元格?
例如,我有这个两列的工作表:
A
abc
dce
fds
B
kjh
abc
我想要的是:
A
A abc
A dce
A fds
B
B kjh
B abc
我尝试了像“=IF(ISBLANK(A2), A1, A2)”这样的公式,但它警告我有关冗余并且不起作用。
如何用前面的最后一个非空白单元格填充空白单元格?
例如,我有这个两列的工作表:
A
abc
dce
fds
B
kjh
abc
我想要的是:
A
A abc
A dce
A fds
B
B kjh
B abc
我尝试了像“=IF(ISBLANK(A2), A1, A2)”这样的公式,但它警告我有关冗余并且不起作用。
Select the column, go to Edit > Go To > Special > Blanks, type = in the formula bars, hit the up arrow then Ctrl+Enter. you should now have the cells fill with the values above
Select the range where you want to fill the blank cells,
Then click on Developer Tab -> Visual Basic -> Insert -> Module
Then paste the code in the Module, and click on run:
Code:
Sub Fill_Blank_Cells()
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
End Sub
As @Jerry rightfully pointed out, make sure to copy-paste special the values in order to remove the formulas behind your filled column. This will prevent any undesirable results later!