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