Ian Bell
asked on
modify last cell formula
Hi,
The below formula finds bottom row.
Can someone please help me modify it to ignore formula cells.
I only want last cell that contains a value.
=ROW(OFFSET(A9,COUNTA(A:A) -1,0))
Many thanks
Ian
The below formula finds bottom row.
Can someone please help me modify it to ignore formula cells.
I only want last cell that contains a value.
=ROW(OFFSET(A9,COUNTA(A:A)
Many thanks
Ian
ASKER
Sadly not Neeraj. It still displays the last cell containing a formula.
How about this?
=ROW(OFFSET(A9,MATCH(2,1/( A9:A10000< >""))-1,))
=ROW(OFFSET(A9,MATCH(2,1/(
ASKER
That one produced a #N/A error.
Excel 2011 (for Mac) and Excel 2013 (Windows) introduced the ISFORMULA function. You can use that to identify cells with formulas that need to be excluded.
The row number of the last cell with data in column A that does not have a formula may be found using:
The row number of the last cell with data in column A that does not have a formula may be found using:
=AGGREGATE(14,6,ROW(A:A)*NOT(ISFORMULA(A:A))/(A:A<>""),1)
If you want a range reference pointing to the cell below that, you might use:=INDEX(A:A,AGGREGATE(14,6,ROW(A:A)*NOT(ISFORMULA(A:A))/(A:A<>""),1)+1)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use this user defined function by putting it in a code module.
Usage: =lastnf("A")
Usage: =lastnf("A")
Function LastNF(strCol As String) As Long
Dim lngLastRow As Long
lngLastRow = Range(strCol & "1048576").End(xlUp).Row
For LastNF = lngLastRow To 1 Step -1
If Cells(LastNF, 1).HasFormula = False Then
Exit Function
End If
Next LastNF
End Function
I just edited the above.
ASKER
Bingo... Neeraj your formula worked.
Byundt your formula selected the top row
Byundt your formula selected the top row
ASKER
Thanks guys, Neeraj's formula was perfect.
You're welcome Ian! Glad it worked as desired.
Byundt your formula selected the top rowI tested my suggestion before posting, and it seemed pretty reliable in finding the row number of the last cell with a value and no formula. Could you post the formula you actually used when testing the suggestion?
ASKER
Byundt, this was the one.
=AGGREGATE(14,6,ROW(A:A)*N OT(ISFORMU LA(A:A))/( A:A<>""),1 )
=AGGREGATE(14,6,ROW(A:A)*N
Does this work for you?
=ROW(OFFSET(A9,COUNTA(A:A)