title: Test if cell contains "#REF!"
body: <p>I have an Excel workbook, with many pivot tables on each sheet. I'm using the pivot tables to display lots of "counts" from my analytic table on another sheet. For example, if the attribute A three levels each, I'm making tables of how many rows fall into A1, A2, and A3.</p>
  
  <p>I also need to create separate, non-pivot tables, which reference the original pivot tables in order to fill in the values which are missing from them. So from the above example, if there are currently no rows with attribute A2, that row wouldn't exist in the pivot table. However, later when I get an updated data sheet I can expect there to be rows with attribute A2. I'd like to create a reference in my second table which can evaluate to 0 when there is not a row for A2 in the pivot table, but when everything gets refreshed takes on the now existing value for A2.</p>
  
  <p>When I try to reference the row using GETPIVOTDATA, I get #REF! if the cell doesn't exist in the pivot table. Essentially, I've just had trouble figuring out how to say:</p>
  
  <pre><code>if (GETPIVOTDATA equals #REF!)
    cell equals 0
  else
    cell equals GETPIVOTDATA
  </code></pre>