Geeks With Blogs
SSRS Blog Reporting Services

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!

Posted on Tuesday, December 15, 2009 2:37 PM SSRS , FYI | Back to top


Comments on this post: Exporting SSRS Report with Excel Formulas Preserved

# re: Exporting SSRS Report with Excel Formulas Preserved
Requesting Gravatar...
Cool, this works but just to an extent. Instead of populating formulas with named references for cells, I was hoping to see A1 cell references. Is that possible? OR, at the very least, taking control of the naming of the cells?
Left by Smashmouth on Feb 18, 2010 8:12 AM

# re: Exporting SSRS Report with Excel Formulas Preserved
Requesting Gravatar...
Thanks. However the formulae show named ranges (_43) instead of cell reference (B1). Is it possible to do the latter?
Left by Pallab Gupta on Jul 19, 2011 10:19 AM

# re: Exporting SSRS Report with Excel Formulas Preserved
Requesting Gravatar...
Not usefull.
Left by manishKumar1980 on Nov 12, 2011 10:34 PM

# re: Exporting SSRS Report with Excel Formulas Preserved
Requesting Gravatar...
I did try to export to excel with preseved formula by using reportitems but in expression it did not take fieldname and I can not put textbox in expression either.
I tried to create web form and export ssrs from aspx but the same problem. i could not preserve excel formula so that user can play with it. please help.
Left by mohammad on Jan 27, 2013 1:39 PM

# re: Exporting SSRS Report with Excel Formulas Preserved
Requesting Gravatar...
Worth pointing out that this doesn't work in version of SSRS later than 2005.
Left by foo on Oct 09, 2015 3:55 AM

# re: Exporting SSRS Report with Excel Formulas Preserved
Requesting Gravatar...
What foo said.

https://msdn.microsoft.com/en-us/library/ms143380%28v=sql.100%29.aspx#Anchor_3
Left by steve on Sep 14, 2016 6:45 AM

Your comment:
 (will show your gravatar)


Copyright © ssrs | Powered by: GeeksWithBlogs.net