CUBERANKEDMEMBER Function

Excel Functions › Cube

Excel 2007+ Data Model / OLAP

The Excel CUBERANKEDMEMBER function returns the nth item of a CUBESET — rank 1, rank 2, rank 3 — which makes living top-10 leaderboards that re-rank themselves whenever the Data Model refreshes.


Quick answer: the #1 member of the sorted set stored in B2:
=CUBERANKEDMEMBER("ThisWorkbookDataModel", $B$2, 1)
Copy down with ROW()-offset as the rank to spill out the whole leaderboard.

Syntax

=CUBERANKEDMEMBER(connection, set_expression, rank, )
ArgumentDescription
connectionRequired"ThisWorkbookDataModel" for Power Pivot.
set_expressionRequiredA CUBESET cell reference (usual) or a literal set expression.
rankRequired1 = first item, 2 = second… use ROW() arithmetic to fill a column.
captionOptionalDisplay text override.

What you need first: cube functions only work against a Power Pivot Data Model (or an external OLAP cube). Add your table to the model — check “Add this data to the Data Model” when inserting a PivotTable, or use the Power Pivot tab — then reference it with the connection name "ThisWorkbookDataModel" and MDX-style member strings like "[Measures].[Total Sales]" or "[Products].[Category].[Displays]".

How to use it

Full leaderboard pattern (set sorted descending by sales in B2):

B5: =CUBERANKEDMEMBER("ThisWorkbookDataModel", $B$2, ROW()-4)
C5: =CUBEVALUE("ThisWorkbookDataModel", "[Measures].[Total Sales]", $B5) // sales for that rank — copy both down

Try it: interactive demo

Live demo

Drag the rank and watch which customer the formula returns from a sample sorted set.

Result:

Errors & common pitfalls

#NAME? — bad connection name. The first argument must exactly match a workbook connection; for the built-in Data Model it is "ThisWorkbookDataModel", quotes included.

#N/A — invalid member expression. Table, column, or item names in the MDX string don’t match the model. Check spelling and bracket every level: [Table].[Column].[Item].

“#GETTING_DATA” flashes in cells. Normal — Excel retrieves cube results asynchronously. It resolves when the query finishes.

Performance: hundreds of separate CUBEVALUE calls query the model one by one. Pull shared members into CUBEMEMBER cells once and reference those cells in your CUBEVALUEs.

Practice workbook

📊
Download the free CUBERANKEDMEMBER practice workbook
Every example on this page, ready to open in Excel — plus practice challenges with answers on a separate tab. No sign-up required.

Frequently asked questions

How do I make the rank increase as I copy down?
Use row arithmetic: if your list starts on row 5, ROW()-4 gives 1, 2, 3… as you copy down.
My leaderboard isn't sorted by value — why?
The ranking comes from the SET's sort, not from CUBERANKEDMEMBER. Define the CUBESET with sort_order 2 (descending) and a sort_by measure.
What happens when rank exceeds the set size?
You get an empty result/#N/A. Wrap in IFNA to show a blank for short lists.
Can I get the value, not the name?
CUBERANKEDMEMBER returns the member. Feed that cell into CUBEVALUE alongside a measure to get its number.

Master functions like this in one day

This page covers one function. Our Excel Formulas and Functions class covers the 30 that matter most — live, hands-on, taught by professionals in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related functions: CUBEVALUE · CUBEMEMBER · CUBESET · GETPIVOTDATA · GROUPBY