How to Group and Filter Excel Values by a Department Range
Question details
The user needs to calculate the sum of unique items and locations filtered by a specific department range (such as departments 3000 through 4000) using dynamic array formulas.
- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Grouping data values and summarizing them based on a numeric department range boundary.
- Observed behavior
- The user wants to output grouped unique items and locations, alongside their summed values, by dynamically filtering out data outside the designated department range.
Ensure your dataset is organized in clear, continuous columns (e.g., Department, Item, Location, Value) and note the specific cell references holding your minimum and maximum department range criteria.
Use the GROUPBY Function with a Range-Based Filter
The most efficient method to group data and sum values based on numerical range criteria using a single dynamic array formula.
The GROUPBY function allows you to group rows, calculate aggregations like SUM, and filter results in a single step by applying boolean logic arrays.
Click on an empty cell where you want the top-left corner of the grouped results to appear.
Type the formula using the syntax: =GROUPBY(B4:C13,D4:D13,SUM,,0,,((A4:A13>=G1)*(A4:A13<=G2)))
Ensure B4:C13 represents your item/location columns, D4:D13 is your values column, A4:A13 is the department column, and G1/G2 are the cells containing your minimum and maximum department numbers.
Press Enter. The formula will spill the unique items, locations, and their corresponding sums automatically.
Use a Dynamic Worksheet Formula (UNIQUE and FILTER)
A flexible alternative using standard dynamic array functions if the GROUPBY function is unavailable in your current version.
Apply Filters and Slicers in a PivotTable
A visual, formula-free approach for grouping departments into ranges.
Group and Filter Data Easily with WPS Spreadsheet
WPS Spreadsheet provides robust support for dynamic array functions, complex formulas, and powerful PivotTables. It allows you to quickly group, filter, and summarize large datasets without compatibility issues.
- 1. Open your dataset: Launch WPS Spreadsheet and open the file containing your department data.
- 2. Use dynamic formulas: Navigate to the Formulas tab to insert dynamic functions like UNIQUE, FILTER, or advanced SUMIFS combinations.
- 3. Insert a PivotTable: If you prefer a visual method, highlight your data, go to the Insert tab, and click PivotTable to automatically aggregate your values.
- 4. Apply data slicers: Add Slicers to your PivotTable to instantly filter your data by specific department ranges with a single click.

Frequently Asked Questions
Why is my dynamic array formula returning a #CALC! or #VALUE! error?
This usually happens if the ranges provided in your formula (like the department range, item range, and value range) are not of equal size. Check your cell references to ensure they all cover the exact same number of rows.
Can I filter by multiple, non-continuous department ranges?
Yes, you can apply OR logic in your formula's filter criteria by using the plus sign (+). For example, to include ranges 3000-4000 and 6000-7000, structure your criteria as: ((A4:A13>=3000)*(A4:A13<=4000))+((A4:A13>=6000)*(A4:A13<=7000)).
Do dynamic array functions update automatically when data changes?
Yes, dynamic arrays like FILTER and UNIQUE automatically update and resize (spill) when the source data within the referenced range is modified.




