I have a column that'll have dynamic filled in fields but will be empty for the most part. I want to find the difference of last two values found in a column but nothing I've tried seems to work.
Asked
Active
Viewed 6,267 times
2 Answers
2
This will get the value of the second cell up from the bottom:
=INDIRECT("A"&MAX(ARRAYFORMULA(row(A:A)*--(A:A<>"")-1)))
ZygD
- 2,497
1
Not beautiful, but it works:
=INDEX(FILTER(A:A;NOT(ISBLANK(A:A)));ROWS(FILTER(A:A;NOT(ISBLANK(A:A)))))-INDEX(FILTER(A:A;NOT(ISBLANK(A:A)));ROWS(FILTER(A:A;NOT(ISBLANK(A:A))))-1)
Assuming you have values in column A, filter out empty cells, return squeezed array last value by counting rows, return squeezed array penultimate value by counting rows and subtracting 1.
SΛLVΘ
- 1,405
=MATCH(9.99999999999999E+307,A:A,1). Once you have that, you can use a similar formula to find the location of the second to last entry, and then use those andINDEXto get the values at those locations. Those are Excel though, I don't know if they're available or work the same way in Google Sheets, but maybe it's a place to start. And excellent correct use of penultimate. :-) – blm Nov 06 '15 at 18:09