Get the last "non empty" value in a column

Unsolved

I have a data like this. The non empty value is replaced by "---" so technically there's no empty value in the table.

|| || |Red|White|Blue|Yellow| |19.40%|13.33%|29.63%|15.15%| |---|5.56%|27.27%|25.93%| |---|30.30%|21.62%|32.26%|

---------20.69%

I've already this formula that worked for awhile.

=ArrayFormula(INDEX(A2:D6,MAX((A2:D6<>"---")*(ROW(A2:D6))),MATCH(E1, A1:D1,0)))

E1 has a value that determine which one is called for current situation so for example if it's "Blue", then it will refer to that "Blue" column to find last non-empty value. Expected value is "21.62%" but now, it output "---" instead.

Back when it called "Yellow", it output "20.69%" correctly. Perhaps it just refer to the lowest non empty value in the last row of "Yellow" column and then just output the same row for other column?

Q: How to make it called the last row in each column correctly?

p/s: The colors used in the table are just placeholders.

Posted Aug 18, 2024, 4:36 AM UTC

25
Loading comments…