Ahh Microsoft Excel, the key tool of every financial analyst across the world. Where would we be without you? What application would receive all of the notoriety for analysts mistakenly leaving in sensitive data in a hidden column? How would an analyst store tons of data that is a pain to mine?
As part of our conversion of some of our legacy Excel "systems" we have had to still produce Excel Reports. These reports have the strict requirement that when they are exported to Excel, they should still have the formulas so Analysts can do some scenario analysis. Lets ignore the analysis portion and get into the good old-fashioned coding part.
First, go ahead and read this article from SSRS books:
http://msdn.microsoft.com/en-us/library/ms159220%28SQL.90%29.aspx
Ok, did you read it? Was your question already answered? Awesome! Did you skip it and just want the answer here? Fine fine....
If you want the expression to export into Excel (so the user can play with the Excel spreadsheet and see values update dynamically) - you will need to set the field value to something like this:
=ReportItems!txtBox1.Value + ReportItems!txtBoxTwo.Value
See? that was fairly easy.
Some gotchas:
1) Putting in a lot of formulas WILL make your report run slower/take much longer to render
2) Make sure the cells are properly formatted (text, numeric, etc) before exporting as Excel can get confused.
3) Always make sure your SSRS Server is patched and up-to-date!