google spreadsheet - How does this formula to return the last value in a column work? -


this formula returns last value in column:

=index(a:a;max((a:a<>"")*(row(a:a)))) 

can't understand how works because part max((a:a<>"")*(row(a:a))) returns 0.

any ideas?

for sake of answer. segment:

=max((a:a<>"")*(row(a:a))) 

returns 0 if row in has blank cell in columna, otherwise 1.

as array formula (ctrl+shift+enter before enter) get:

=arrayformula(max((a:a<>"")*(row(a:a))))   

returns row number of last populated cell in columna.

simplifying example of 3 rows first (row1) blank:

the 'not blank' part returns array of: false,true,true
, row part of 1,2,3

so multiplying (the *) these gives array 0,2,3 (multiplying false equivalent multiplying 0 , true equivalent times 1).

the max function selects largest value (3).

the index function 'reads' above return value in columna in last (third) row.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -