Skip to Content
Author's profile photo Former Member

VBA created named ranges to make lookups from your data sheet easier

Performance is the most critical factor for our users when they refresh reports. We’re on SAP BPC 10.1 for NW on HANA but we still rely on streamlining the client side process to improve the user experience. We’ve found best way to accomplish this is to consolidate information into a single report and leverage native excel functionality to lookup data from the report, instead of multiple reports across multiple tabs.  Our biggest example of this is a packet of over 20 reports, each on its own excel sheet, all fed by a single EPM report that refreshes in about 15 seconds.

While this has proven to be the optimal design for our real-time on demand reporting packets, accessing the report data from the data tab can be troublesome specifically if the report is dynamic and members change depending on selected context.  This is the problem I sought to standardize, and make data tabs easier to utilize.

Incorporate the VBA code below in any excel workbook and it will automatically create excel named ranges for the Rows, columns, and data section of the report that can be leveraged to access the data contained in the EPM Reports.  Each named range correlates to the report ID such as Report001 will have a RowRng001, a ColRng001, and a DataRng001.


Take the example report below. The ranges created are colored to show the result of the VBA code.


This data is now accessible using the following index match formula shown below, and when locked on the reference rows and columns, the formula can be copied and pasted to provide the data for the report.


In a more complex report, multiple rows or columns are used to create the right intersection of data, even in those circumstances this can be leveraged.  As in the example below I’ve used a local member to concatenate the members to create a lookup within the data section of the report.


The data can be accessed by matching on the first column of the data range as shown by the formula below. (note: I forgot to include the iferror wrapper on this version of the excel function)


Feel free to leverage this code as it has made building reports much simpler.

Anyone diving into the code might also see Include functionality. Here is a brief overview of that: Complex formulas that are not stored and need to be calculated on the fly are better done client side.  (We dream of the day when HANA MDX can be incorporated into our models and not cause a performance hit)  Similar to the function EPM Copy range, sometimes we want our data to include extra formulas across the entire report.  The Include functionality built into this VBA will do that.  Formulas found in a named range such as Include001, will be incorporated into the report as the names are built to make it easier to access these calculations.  Note: names are expected to be given just above the include range.  See picture below:


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Vadim Kalinin
      Vadim Kalinin

      Ups, EPM - Do It Yourself 🙂

      By the way the code like:

      Range("Include" & sReportID).Offset(-1, 0).Copy

              IncludeRng.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _

                  SkipBlanks:=False, Transpose:=False

      is slow, it's better to copy range to array and then copy array to destination range...


      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks Vadim for the feedback; always looking to make the user experience better.