title: Excel: Calculate difference between cell and cell above in an auto filtered table
body: <p>I have a table with column A containing incrementing numerical values, and column B being a bunch of names. I need to filter the table according the names, and have column C update with the difference between the value in column A in the current row and the cell above..</p>
  
  <p><a href="https://i.stack.imgur.com/2K1o0.png" rel="nofollow noreferrer">For example, I'd like to have something like this</a>
  which, 
  <a href="https://i.stack.imgur.com/TlQMB.png" rel="nofollow noreferrer">when filtered according to the Name column, should update the difference like so</a></p>
  
  <p>I have tried to use SUBTOTAL function in a few different ways but to no avail. Ideally it'd update once the filter in the table is changed. I tried to do this in VBA but so far I've gotten macro that only filters with the hard-coded filter criteria.</p>
  
  <p>Solutions in either excel formulas/python/vba are all welcomed and greatly appreciated!</p>
  
  <p>I apologise in advance if this question isn't up to standards as Im new here :) Thank you in advance!</p>
  
  <p>@JvdV: <a href="https://i.stack.imgur.com/r86xt.png" rel="nofollow noreferrer">This</a> is the outcome of me trying to implement your formula, <a href="https://i.stack.imgur.com/PcsCr.png" rel="nofollow noreferrer">This</a> is after filtering.</p>