Contact

CUBERANKEDMEMBER in Excel: Extract a Position from an Ordered Cube Set

Cube Advanced Microsoft Excel

Retrieve the nth cube-set member, make ranking order explicit, and build a bounded selection list without confusing position with a metric.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

CUBERANKEDMEMBER extracts a member at a particular position in a cube set. The name can sound like a ranking calculation, but the useful question is: position in which ordered set? A second member in an alphabetical selection is not necessarily the second-largest region by sales. Define the set and its order before interpreting the returned member.

Syntax and input contract

=CUBERANKEDMEMBER(connection, set_expression, rank, [caption])

The connection name, set expression and integer rank are required. Supply the set as MDX text, a nested CUBESET or a reference to a CUBESET cell. Rank 1 selects the first item, rank 2 the second. The optional caption changes the displayed label. To list several positions, use a separate call for each rank. Microsoft’s function reference

Use an existing authorized workbook connection and a set whose membership and order are understood. This function does not establish a new server connection merely because a connection name appears in the formula. Match the connection to the model used to define the set.

Worked example: second in a declared order

Assume a fictional TrainingCube connection contains three valid distinct Region members. A2 is assumed to contain a successfully evaluated CUBESET in exactly this order:

  1. North, with unique name [Region].[Region].&[North]
  2. South, with unique name [Region].[Region].&[South]
  3. West, with unique name [Region].[Region].&[West]

The model captions are assumed to be North, South and West. In B2, the unexecuted formula is:

=CUBERANKEDMEMBER("TrainingCube",$A$2,2)

If every assumption holds, the returned member would be South and its caption would be displayed. This is a conditional explanation of the defined order, not an observed server response. The example deliberately makes no claim about South’s sales, size or performance.

To use a display label instead, the expression could be:

=CUBERANKEDMEMBER("TrainingCube",$A$2,2,"Second selected region")

The expected visible caption is then Second selected region under the same successful-resolution assumption. A custom label can make a report readable, but it can also hide which member is selected. Consider retaining an ordinary-caption cell or a separate selection description for audit.

Advanced use: top and bottom selections

Suppose the fictional model additionally defines a valid Units sorting measure with North = 30, South = 20 and West = 10. If CUBESET sorts these members descending by that measure, positions 1, 2 and 3 would correspond to North, South and West. If the set instead sorts ascending, position 1 would correspond to West. In both cases CUBERANKEDMEMBER selects a position; the upstream sort makes that position meaningful.

For a top-three report, place 1, 2 and 3 in B5:B7, and use this pattern in C5:

=CUBERANKEDMEMBER("TrainingCube",$A$2,B5)

Fill down only for positions known to exist in the selected set. Make the report title name the sorting metric and direction. A title such as Top regions by Units is justified only if A2 was actually defined and successfully evaluated using that ordering. Microsoft’s CUBESET reference explains its sort-order and sort-by controls.

Ties deserve their own policy. The toy values are intentionally distinct, so they cannot establish a stable order for equally valued members. A production report comparing refreshes should not treat a changed tie order as proof of a changed measure. Resolve deterministic tie requirements in the model or report specification and validate them separately.

Rank boundaries and error handling

Keep rank a positive integer within the known set size. The dedicated reference describes integer positions but does not give a complete table for zero, negative, fractional or beyond-the-end inputs. This guide therefore does not invent exact error codes or truncation behavior for those cases. A reliable report avoids them by checking its input policy and available set size.

Documented errors include #NAME? for an invalid workbook connection or unavailable/erroring OLAP server, and #N/A for malformed set syntax or dimension-incompatible set membership. A temporary #GETTING_DATA… can appear during retrieval. Microsoft’s error remarks

Diagnose the upstream set before modifying the rank formula. First confirm the connection, then the membership, then the ordering, and finally the requested position. IF can express a display policy once these prerequisites are known. Keep IFERROR from masking an upstream outage as a missing ranked item, and use FORMULATEXT when an audit sheet needs to expose each expression.

Availability and evidence

Microsoft’s dedicated reference, checked October 18, 2026, lists Excel for Microsoft 365 and Excel 2024/2021 on Windows and Mac, Excel 2019/2016, iPad, iPhone, Android tablets/phones and Excel Web App. Those labels describe the article’s scope; they do not prove that every listed client can create or refresh every OLAP connection. Check the actual workbook, provider, permissions and client before deploying a report. No subscription entitlement beyond those product labels was established here.

First introduction and last functioning build are unknown. No Excel installation, workbook connection or server query was performed. Every model and output in this guide is hypothetical or a documented conditional expectation; no native result or screenshot is claimed.

Official CUBERANKEDMEMBER reference.