title: How to Assign Series .Formula for a Chart in PowerPoint
body: <p>During the course of my due diligence, I've managed to solve this question. I am posting it because it may be helpful to others, and also to entertain possible alternative solutions.</p>
  
  <p>The <code>chartData</code> object (worksheet) contains an embedded chart's data in a <code>ListObject</code> table.</p>
  
  <p>I can successfully manipulate this <code>ListObject</code>, but I am having a hard time getting the resulting chart to reflect the data correctly.  I expect to have Category Labels in Row 1, and Series Names in column A, such as:</p>
  
  <pre><code>    A       B       C
  1      |   Cat1  |  Cat2   |
  2  srs1|   75%   |   25%   |
  3  srs2|   68%   |   32%   |
  </code></pre>
  
  <p>For most charts, I can do this:</p>
  
  <pre><code>Sub Main()
  Dim c as Chart
  Set c = ActivePresentation.Slides(1).Shapes("Chart 1")
  UpdateChart c
  End Sub
  
  Sub UpdateChart(cht As Chart)
  Dim chtFormula$
  Dim chtSheet As Worksheet
  Dim lTable As ListObject
  Set chtSheet = cht.chartData.Workbook.Sheets(1)
  Set lTable = chtSheet.ListObjects(1)
          chtFormula = "='" &amp; chtSheet.name &amp; "'!" &amp; lTable.Range.Address
          cht.ApplyDataLabels
          cht.SetSourceData chtFormula, xlRows
  End Sub
  </code></pre>
  
  <p>Which yields example chart like:</p>
  
  <p><img src="https://i.stack.imgur.com/62QGq.png" alt="enter image description here"></p>
  
  <p>Problems arise, however, when the "Series" names in Column A are numeric strings, for example if the series names are "2012" and "2011", then that function returns this abomination:</p>
  
  <p><img src="https://i.stack.imgur.com/Rqcph.png" alt="enter image description here"></p>
  
  <p>Manually opening the "Select Data" dialog confirms:</p>
  
  <p><img src="https://i.stack.imgur.com/e4QcQ.png" alt="enter image description here"></p>
  
  <p>If I manually edit the series, I can achieve the desired results:</p>
  
  <p><img src="https://i.stack.imgur.com/YoeI8.png" alt="enter image description here"></p>
  
  <p>But so far, I have been unable to do this in VBA.  A debug statement yields a series <code>.Formula</code> as I would expect:</p>
  
  <p><code>=SERIES(,Sheet1!$A$1:$C$1,Sheet1!$A$2:$C$2,1)</code></p>
  
  <p>But if I try to manipulate a formula string, and then assign to the <code>.Formula</code> property, I get the 'Method '.Formula' of Object 'Series' Failed`:</p>
  
  <p><img src="https://i.stack.imgur.com/9Rtqj.png" alt="enter image description here"></p>
  
  <p>I dig through the documentation and see that <a href="http://msdn.microsoft.com/en-us/library/office/ff743895%28v=office.14%29.aspx" rel="nofollow noreferrer">Formula is indeed a property</a> available in PowerPoint charts.  But it's not working.</p>
  
  <p>Any ideas?</p>