title: Google sheets COUNTIF excluding hidden rows
body: <p>In google sheets, I have a list of strings (1 per row) where each string is split with 1 character per column, so my sheet looks something like below:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th></th>
  <th>A</th>
  <th>B</th>
  <th>C</th>
  <th>D</th>
  <th>E</th>
  <th>F</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td><strong>1</strong></td>
  <td>F</td>
  <td>R</td>
  <td>A</td>
  <td>N</td>
  <td>K</td>
  <td></td>
  </tr>
  <tr>
  <td><strong>2</strong></td>
  <td>P</td>
  <td>A</td>
  <td>S</td>
  <td>S</td>
  <td>1</td>
  <td>2</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I then have this sheet filtered, so Can select only the rows where the first character is F, for example. On another sheet in the same workbook, I have a table of how often each character appears in each column, that looks something like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th></th>
  <th>A</th>
  <th>B</th>
  <th>C</th>
  <th>D</th>
  <th>E</th>
  <th>F</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td><strong>1</strong></td>
  <td><strong>Char</strong></td>
  <td></td>
  <td><strong>Overall</strong></td>
  <td><strong>1</strong></td>
  <td><strong>2</strong></td>
  <td><strong>3</strong></td>
  </tr>
  <tr>
  <td><strong>2</strong></td>
  <td>A</td>
  <td></td>
  <td>979</td>
  <td>141</td>
  <td>304</td>
  <td>165</td>
  </tr>
  <tr>
  <td><strong>3</strong></td>
  <td>B</td>
  <td></td>
  <td>281</td>
  <td>173</td>
  <td>69</td>
  <td>15</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I would like to have this table dynamically update, so that when I filter the first sheet my table shows the frequency only for the strings that meet the filter.</p>
  <p>In Excel, this can be accomplished using a combination of SUMPRODUCT and SUBTOTAL but this doesn't work in google sheets. I've seen this done in sheets using helper columns, but I would like the solution to work for a string of an arbitrary number of strings with different lengths without having to change the sheet. Can this be done in Google Sheets?</p>
  <p>Thanks!</p>