I have the following Excel-Spreadsheet:
A B C D E F G H I J
1
2
3
4 200 150 80 300 4
5 200 150 80 150 2
6
7
In Range J4:J5
I have the following formulas:
J4 = MATCH(LOOKUP(2,1/(D4:I4<>0),D4:I4),D4:I4,0)
J5 = MATCH(LOOKUP(2,1/(D4:I4<>0),D4:I4),D4:I4,0)
With this formula I want to identify the last non-empty cell within the range and get the the column number of it back. All this works perfectly in Cell J4
.
However, in Cell J5
I get back number 2 instead of number 4. As far as I can see the reason for this is that in Range D5:I5 the values are not unique (150 appears two times).
What do I need to change in my formula to always get the column number of the last non-empty cell no matter if the values are unique or not?
The answer from this question does not help because my range is not starting in Column A
.
The range can be anywhere on the sheet.
200,150,,300
. And are these actually formula results or just typed values? – JvdV