title: Calculated Field in Pivot Table using Conditional Formula VBA
body: <p>I have this problem that I can't solve, I'm writing an Excel Macro that build up a pivot table taking the data from a table.
  When a field in the table is 0 I don't want to perform the calculation of the calculated field and display a blank cell in the pivot table.</p>
  
  <p>my conditional formula is this one:</p>
  
  <pre><code>=IF((field1=0),"",(field1/field2))
  </code></pre>
  
  <p>Putting this formula into VBA as follows</p>
  
  <pre><code>pt.CalculatedFields.Add Name:="ptfieldname", Formula:="=IF((field1=0),"",(field1/field2))"
  </code></pre>
  
  <p>display an empty pivot table, when I put the same formula in excel using the "Fields, Items &amp; Set" button in the pivot table option tab goes well...
  so I think that the formula is right, but what I have to do to get it permorf well also within the VBA macro?!</p>
  
  <p>thanks in advance</p>