title: Exporting formulas to excel from ssrs 2008R2
body: <p>I am aware that in 2008 the method of exporting formula to excel was downgraded <a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ddf2f19d-3f70-4bb0-a035-00709ffee2f9/excel-formulas-in-ssrs-2008?forum=sqlreportingservices" rel="nofollow noreferrer">see here</a>.</p>
  
  <p>But I have seen a workaround for a static formula where the same formula is required (see <a href="https://stackoverflow.com/questions/19584986/ssrs-report-export-to-excel-formulas">Here</a> and <a href="https://stackoverflow.com/questions/31000303/how-to-insert-excel-formula-to-cell-in-report-builder-3-0">here</a>). However I have the case where I need a relative formula when I export to excel. Is there a newer solution out there does anyone know?</p>
  
  <p>This is my workings so far
  The result I am after is cell <code>(T,r3) = cell (R,r3)-cell(O,r3)</code> and then <code>cell (T,r4) = cell (R,r4)-cell(O,r4)</code> and so on in excel I would expect to see
  in cell <code>T3 the formula =R3-O3</code>
  and cell <code>T4 the formula =R4-O4</code></p>
  
  <pre><code>      O!P!Q!R !S!T!
  r3  1    5   N   5           4  
  r4  3    5   N   10          7  
  </code></pre>
  
  <p>(Sorry I can not get the table to line up)</p>
  
  <p>my ssrs expression is </p>
  
  <pre><code>="=R"+cstr(RowNumber("DataSet1")+2)+"-O"+cstr(RowNumber("DataSet1")+2) 
  </code></pre>
  
  <p>where DataSet1 is what my ssrs tablix is based on and the +2 element is to offset to allow how the titles of the report and the table move the first row of data down the excel sheet.</p>
  
  <p>The output is achieve in the cells when exported to excel is the formula as text in the cell content and if I click into the cell and press backspace and return the formula works. It appears that some white space is being exported or excel just treats every thing as text on the import routine</p>
  
  <p>I can of course use and find and replace on this statement in excel</p>
  
  <p><code>="=R"+cstr(RowNumber("DataSet1")+2)+"-O"+cstr(RowNumber("DataSet1")+2)</code>  as suggested but was trying to be more elegant</p>
  
  <p>I do not suppose you can export some code to run in excel as vba to do the find and replace function at a button press for the user?</p>
  
  <p>Has anyone any suggestions - thanks</p>
  
  <p>Ian</p>