Dynamic and Parameter-Driven Lookups
Swipe to show menu
The workbook already supports relational lookups and dynamic reporting. In this chapter, build category-level summaries and introduce parameter-driven logic that changes calculations dynamically based on user-selected scenarios.
SUMPRODUCT Structure
=SUMPRODUCT(array1 * array2 * ...)
array1: first calculation array;array2: second calculation array;TRUE: converted into1;FALSE: converted into0.
This allows logical conditions and aggregation to happen inside a single formula.
INDIRECT Structure
=INDIRECT(ref_text, [a1])
ref_text: text converted into a live reference;[a1]: optional reference style argument.
INDIRECT allows formulas to switch references dynamically based on cell values.
Inside the Summary sheet, add the following headers:
Category
Total_Revenue
Total_Cost
Total_Profit
Inside A10, type:
=UNIQUE(Products[Category])
The category list now expands automatically as new categories are added.
Inside B10, type:
=SUMPRODUCT((XLOOKUP(Sales_Data[Product],Products[Product],Products[Category],"")=A10)*Sales_Data[Revenue])
XLOOKUP(...): retrieves category values for every product;=A10: checks whether the category matches;Sales_Data[Revenue]: values being aggregated.
Fill the formula down the column.
Inside C10, type:
=SUMPRODUCT((XLOOKUP(Sales_Data[Product],Products[Product],Products[Category],"")=A10)*XLOOKUP(Sales_Data[Product],Products[Product],Products[Cost],0)*Sales_Data[Units])
The formula dynamically calculates total cost by category.
Inside D10, type:
=B10-C10
Fill the formula down and format all values appropriately.
Inside the Summary sheet, create a cell for:
Active Pricing Scenario
Apply Data Validation using the following options:
Pricing_Tiers
Pricing_Tiers_Promo
Inside Sales_Data, replace the previous discount formula with:
=XLOOKUP([@Units],INDIRECT(Summary!$F$9&"[Min_Units]"),INDIRECT(Summary!$F$9&"[Discount_Rate]"),0,-1)
Summary!$F$9: selected scenario table;INDIRECT(...): converts text into active table references;-1: approximate match mode.
The lookup now switches dynamically between pricing scenarios.
Change the selected value inside the scenario dropdown.
Confirm that:
Discount_Rateupdates automatically;Discounted_Revenueupdates automatically;- All dependent calculations react to the selected pricing model.
1. What is the role of SUMPRODUCT in this lesson?
2. Why is INDIRECT used in parameter-driven models?
3. What is the main benefit of using UNIQUE with SUMPRODUCT in summary tables?
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat