title: Extract matching data from varying number of row
body: <p>I am trying to build graphic indicators from a (potentially) large set of data using google-spreadsheet.</p>
  
  <p>So far, I've used a pivot table to extract the information from the raw data, and I want to build intermediate tables to calculate the different values I need for my indicators.</p>
  
  <p>So far, my pivot table looks as follow :</p>
  
  <pre><code>                     Status1 | Status2 | Status3 | Status4
                       -------------------------------------
  Country1 | Domain1 |    1    |    2    |   1     |   
             Domain2 |         |    2    |         |   
  ----------------------------------------------------------
  Country2 | Domain1 |         |         |         |   1
  ----------------------------------------------------------
  Country3 | Domain2 |         |    1    |         |   3
             Domain3 |         |         |   1     |   
  </code></pre>
  
  <p>And I would like to generate the following table (there is a fixed number of Status &amp; Domain) :</p>
  
  <pre><code>         Status1 | Status2 | Status3 | Status4 | Domain1 | Domain2 | Domain3
           -------------------------------------------------------------------
  Country1 |    1  |    4    |   1     |    0    |    4    |   2     |   0
  ----------------------------------------------------------------------------
  Country2 |    0  |    0    |   0     |    1    |    1    |   0     |   0
  ----------------------------------------------------------------------------
  Country3 |    0  |    1    |   1     |    3    |    0    |   4     |   1
  </code></pre>
  
  <p>As the number of country and the number of rows present in the pivot table for each country will vary, I am unsure as to how to generate this table.</p>
  
  <p>So far I was able to generate the 1st column using the following formula : <code>UNIQUE(FILTER('myRange',NOT(ISBLANK('myRange'))))</code>, but I don't know how to proceed afterward. Is there a way to dynamically extract such data ? Should I change my pivot table ? Maybe build a pivot table using my 1st pivot table ?</p>