title: Combining between Sumif and subtotal with tables in Excel
body: <p>I have the following table in Excel</p>
  
  <pre><code>A - B - C
  
  amount - type - tag
  
  4 - Debit - nice
  
  5 - Credit - nice
  
  32 - Debit - bad
  
  31 - Credit - bad
  </code></pre>
  
  <p>for calculation of total I used the following formula:</p>
  
  <pre><code>=sumif([type],"Credit",[amount])-sumif([type],"Debit",[amount])
  </code></pre>
  
  <p>I got 0, which is right.</p>
  
  <p>but then I filtered the table to show "nice" tags only, but the result didn't change to 1, it remained 0.</p>
  
  <p>How can I solve this problem so that subtotal is calculated when values are filtered according to tag?</p>