Excel Formulas for Aggregating Grouped Data with Custom Percentiles

📅 Jul 09, 2026 📝 Sarah Miller

Analyzing segmented performance data-specifically calculating custom percentile ranks within distinct subgroups-frequently presents a complex, manual hurdle for Excel users. When evaluating allocations from standard funding sources, basic rank functions fail to dynamically isolate cohort boundaries.

Transitioning to dynamic arrays grants analysts the mathematical precision needed to automate group-level insights. However, this approach carries the stipulation that source arrays must maintain uniform data types to avoid calculation errors. Mastering this technique provides robust portfolio benchmarks to evaluate historical performance. Below, we detail the formula architecture using PERCENTRANK and FILTER to streamline your reporting.

Excel Formulas for Aggregating Grouped Data with Custom Percentiles

In data analysis, summarizing datasets by groups is a foundational task. Excel users are likely familiar with aggregating grouped data using common functions like SUMIFS, AVERAGEIFS, or Pivot Tables. However, when your analytical requirements demand more sophisticated statistical measures-such as calculating custom percentiles or assigning percentile ranks within specific groups-standard aggregation functions fall short. There is no built-in "PERCENTILEIFS" function in Excel.

To perform grouped percentile calculations, you must construct formulas that combine Excel's statistical engine with logical filtering. This guide explores how to aggregate grouped data to find custom percentile values and how to calculate individual percentile ranks within groups, utilizing both traditional array formulas and modern dynamic array functions.

Understanding the Objectives: Percentile vs. Percentile Rank

Before writing formulas, it is crucial to distinguish between the two types of percentile metrics you may need to calculate:

  • Grouped Percentile Values: Finding the actual data value at a specific percentile within a group. For example, "What is the 90th percentile of sales in the West region?" This results in a single aggregated value per group.
  • Grouped Percentile Ranks: Determining where an individual row's value stands relative to its group peers. For example, "What is the percentile rank of Jane's $15,000 sales figure within the West region?" This results in a percentage score between 0 and 1 (0% to 100%) for every row in your dataset.

Scenario 1: Aggregating Grouped Percentile Values

To find a specific percentile value (e.g., the 80th percentile) for grouped categories, you must filter your data range dynamically before passing it to the PERCENTILE.INC or PERCENTILE.EXC functions.

The Modern Solution (Excel 365 & Excel 2021+)

In modern versions of Excel, the FILTER function handles logical grouping elegantly, eliminating the need for legacy array entry methods.

=PERCENTILE.INC(FILTER(Value_Range, Group_Range = Current_Group), Percentile_k)

How it works: The FILTER function strips away any data that does not belong to the target group. The PERCENTILE.INC function then calculates the percentile (where Percentile_k is a decimal between 0 and 1) using only the scoped subset of data.

The Legacy Solution (Excel 2019 and Older)

If you are working on older versions of Excel, you must construct an array formula using an nested IF statement. This approach requires you to confirm the formula with Ctrl + Shift + Enter.

{=PERCENTILE.INC(IF(Group_Range = Current_Group, Value_Range), Percentile_k)}

How it works: The IF statement evaluates the entire array. If a row matches the group, it passes the value to the array; if it does not, it passes FALSE. Since PERCENTILE.INC ignores logical FALSE values, it successfully calculates the percentile of the matching subgroup.

Scenario 2: Calculating Row-by-Row Percentile Ranks Within Groups

If you need to assign a relative percentile rank to each row based exclusively on its group cohort, you will use the PERCENTILE.RANK.INC (or PERCENTILE.RANK.EXC) function.

The Modern Solution (Excel 365 & Excel 2021+)

=PERCENTILE.RANK.INC(FILTER(Value_Range, Group_Range = Current_Row_Group), Current_Row_Value)

How it works: For each row, FILTER extracts the subset of values matching the current row's group. Then, PERCENTILE.RANK.INC evaluates where the current row's value sits within that filtered subset.

The Legacy Solution (Excel 2019 and Older)

{=PERCENTILE.RANK.INC(IF(Group_Range = Current_Row_Group, Value_Range), Current_Row_Value)}

Again, this is an array formula that must be entered using Ctrl + Shift + Enter. It filters out non-matching rows by replacing them with FALSE, allowing the ranking function to focus solely on the matching group.

A Practical Walkthrough

Consider the following dataset representing sales representatives, their respective regions, and their sales volume. We want to calculate the 90th percentile of sales for each region and determine the percentile rank of each individual representative within their specific region.

Rep (Col A) Region (Col B) Sales (Col C) Regional Rank (Col D)
AliceEast$45,000Formula 1
BobWest$82,000Formula 1
CharlieEast$55,000Formula 1
DavidWest$31,000Formula 1
EmilyEast$98,000Formula 1
FrankWest$64,000Formula 1
GraceEast$41,000Formula 1

Step 1: Calculating Individual Row Percentile Ranks Within Region (Column D)

To calculate the percentile rank of Alice's sales ($45,000) specifically within the "East" region, enter the following formula in cell D2 and drag it down through the table:

=PERCENTILE.RANK.INC(FILTER($C$2:$C$8, $B$2:$B$8 = B2), C2)

For Alice, Excel filters the sales array to only include East region values: {45000, 55000, 98000, 41000}. It then ranks 45,000 within this subset, returning approximately 0.333 (or 33.3%). For Bob, it filters the West region values: {82000, 31000, 64000}, ranking 82,000 as 1.000 (100%-the top seller in the West).

Step 2: Aggregating Grouped Percentile Values

To create a summary table of the 90th percentile of sales by region, set up a secondary table as follows:

Region (Col F) 90th Percentile Sales (Col G)
EastFormula 2
WestFormula 2

In cell G2, enter the following formula to find the 90th percentile of the East region:

=PERCENTILE.INC(FILTER($C$2:$C$8, $B$2:$B$8 = F2), 0.9)

This formula returns $85,100 for the East region and $78,400 for the West region when copied down to G3, providing key benchmarks for management evaluation.

Creating a Dynamic Spilling Summary Table

If you are using Excel 365, you can generate a fully dynamic summary table using a single-cell formula that automatically scales if new regions are added. By pairing UNIQUE, MAP, and LAMBDA, you can build a self-updating system.

Place this formula in your target summary cell:

=LET(
    UniqueRegions, UNIQUE(B2:B8),
    90thPercentiles, MAP(UniqueRegions, LAMBDA(reg, PERCENTILE.INC(FILTER(C2:C8, B2:B8 = reg), 0.9))),
    CHOOSECOLS(HSTACK(UniqueRegions, 90thPercentiles), 1, 2)
)

This advanced formula extracts the unique list of regions, uses MAP to apply the grouped percentile calculation to each unique region value, and stacks the columns together to form a dynamic summary block.

Handling Edge Cases and Errors

When aggregating grouped percentiles, you may encounter statistical edge cases that break standard formulas. Implement these preventative design steps to keep your worksheets error-free:

  • Single Data Points: If a group has only one data point, PERCENTILE.EXC will return a #NUM! error because it requires more data points to calculate exclusive boundaries. PERCENTILE.INC is generally safer for small datasets as it can calculate percentiles on single-item groups.
  • Zero or Empty Values: Empty cells within your value range can alter your calculations. The FILTER function should be adjusted to exclude blanks:
    =PERCENTILE.INC(FILTER(C2:C8, (B2:B8 = F2) * (C2:C8 <> "")), 0.9)
  • Error Suppression: If a group has no data, FILTER will return a #CALC! error. Wrap your formula in an IFERROR wrapper to return clean, professional results:
    =IFERROR(PERCENTILE.INC(FILTER($C$2:$C$8, $B$2:$B$8 = F2), 0.9), "No Data")

Conclusion

While Excel does not provide a native PERCENTILEIFS function, combining array concepts or modern dynamic array functions like FILTER allows you to create high-performance statistical tools. Whether you are performing high-level regional sales analysis or running localized cohort grading, mastering these grouped percentile patterns will elevate the complexity and reliability of your spreadsheet models.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.