Search code examples
excelif-statementexcel-formulaworksheet-function

Get value of last visible cell


I am using this formula in cell B1 to get last value of visible cell

=LOOKUP(2;1/((SUBTOTAL(3;OFFSET(A2:A10;ROW(A2:A10)-MIN(ROW(A2:A10));0;1)))*(1-ISBLANK(A2:A10)));A2:A10)

It works well when cell from A1 to A10 doesn't contain a formula. The problem is that this formula not working when the cell contains a formula with an if statement.

For example, when in cell A10 I put the formula =IF(F1=1;1;""), the cell a10 shows blank because the condition is not true - and when I filter data the cell B1 show blank.


Solution

  • Replace:

    1-ISBLANK(A2:A10)

    with:

    LEN(A2:A10)>0

    Regards