I have the following Excel spreadsheet:
A B C D E F
1 | | Jan. Feb. March April May
2 | Profit | 100 200 200
3 | Cell Reference last non-empty cell | ??
In Row 2 you can find the profit for each month. In Cell B3 I want to to display the address of the last non-empty cell in Row 2. For this I tried the following formula:
=ADDRESS(ROW(B2),MATCH((IFERROR(LOOKUP(2,1/($A2:$F2<>0),$A2:$F2),0)),$A2:$F2,0),4,1)
This formula works perfectly if all the numbers in Row 2 are unique. However, in my example above you can see that the profit in Februay
equals the profit in March
; therefore, the formula above gives me the address C2
instead of D2
.
What do I have to change in my formula to always get the address of the last non-empty cell no matter if it is unique or not?