title: subtract the last two non-empty cell in excel
body: <p>This is I think a simple problem but I can't seem to find the right solution for it. I don't know if VBA is needed for it. Basically I just want to subtract the last two non-empty cell in Excel. Example: I have the cell A1 and cell B1 and then subtract the value of A1 from B1 and place this value at the same row but another column C1 and so on. I have read <a href="https://stackoverflow.com/questions/5441885/last-non-empty-cell-in-a-column">this</a> to get the last non-empty cell but I need two non-empty cell and perform operation on them. </p>
  
  <pre><code>=LOOKUP(2,1/(A:A&lt;&gt;""),A:A)
  </code></pre>
  
  <p>Is there an easier way to do this? Or should I use VBA?</p>
  
  <p>EDIT:</p>
  
  <p>the reason is I'm making a somewhat similar to a balance sheet but a simple one, the user will just enter deposited value at the first column and expenses at the second column and then display the balance in the third column.. and vice versa.</p>
  
  <p>EDIT:
  Sample<a href="https://i.stack.imgur.com/EOlub.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EOlub.png" alt="enter image description here"></a></p>