CUBESET Function in Excel: A Set of Members for Top-N Reports

CUBESET Function in Excel: A Set of Members for Top-N Reports featured illustration

📎 This article includes 1 downloadable practice file ↓

⏱ 2 min readUpdated 5 October 2026

LookupLevel: ExpertAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. CUBESET in practice
  5. Where you will use it
  6. Worked example
  7. Mistakes people make
  8. Related functions
  9. Continue learning

CUBESET defines a sorted set from the Data Model — combine it with CUBERANKEDMEMBER for top-10 lists that update themselves.

Advertisement

Syntax

=CUBESET(connection, set_expression, , [sort_order], [sort_by])
Argument What it means
sort_order 2 = descending.

Examples

Example 1

=CUBESET("ThisWorkbookDataModel", "[Products].[Product].Children", "Products", 2, "[Measures].[Revenue]")

All products sorted by revenue.

CUBESET in practice

Where you will use it

  • Define a set like all customers
  • Feed CUBERANKEDMEMBER for Top N lists
  • Dynamic lists from the model

Worked example

WorkbookFormulaResult
Has a Data Model=CUBESET("ThisWorkbookDataModel","[Customer].[Name].Children","Customers")(value from your Data Model)

Needs a Power Pivot Data Model, so this example is not calculated here: the result is whatever your model holds.

Mistakes people make

MistakeWhat to do instead
Wrong connection nameUse ThisWorkbookDataModel for Power Pivot
Typos in namesBuild them with PivotTable > OLAP Tools > Convert to Formulas

CUBEMEMBER · CUBEVALUE

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

⚡ Interactive Practice Lab & Formula Tester:

Test formulas dynamically in our web formula laboratory or download the companion Excel workbook.

📎 Practice files for this article

  • 📗
    Practice workbook: Lookup & reference17 tasks on realistic sales data — type your formula, the Check column turns green when it is right. Answers sheet included.
    ⬇ XLSX · 35 KB

Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong

Leave a Reply

Your email address will not be published. Required fields are marked *