logo
search
Function Problems

How to Find the Top-Selling Product by Subcategory in Excel

Khadija KhanKhadija Khan Oct 15, 2026 870 views

Question details

The user needs a method to identify and return the product with the highest sales volume within specific subcategories, including the ability to handle tied results.

How to Find the Top-Selling Product by Subcategory in Excel
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Analyzing a sales worksheet to determine the best-performing products grouped by subcategory.
Observed behavior
The goal is to dynamically extract the exact product codes with the maximum units sold for a given subcategory entered in a specific cell.
Before you start

Ensure your sales data is organized in clear columns (e.g., Column A for Product Code, Column B for Subcategory, and Column C for Units Sold) and check your spreadsheet software version, as modern functions like FILTER and MAXIFS require Microsoft 365, Excel 2019+, or the latest WPS Office.

Solution 1Recommended

Use Modern Dynamic Array Formulas (Recommended)

Combine MAXIFS, FILTER, and TEXTJOIN to quickly find the highest sales and return the corresponding product codes, seamlessly handling multiple tied products in one cell.

This is the most efficient method for modern spreadsheet software. It dynamically calculates the maximum value for the specified subcategory and filters the product list to match that maximum value.

1
Calculate the maximum sales

First, find the maximum units sold for the target subcategory (e.g., entered in F4) using the formula: =MAXIFS($C$4:$C$11,$B$4:$B$11,F4).

2
Filter the matching products

Use the FILTER function to extract the product codes where both the subcategory matches F4 and the sales match the maximum value calculated in the previous step.

3
Handle tied results with TEXTJOIN

Wrap the entire formula in TEXTJOIN so that if two or more products have the exact same top sales, they are combined in a single cell separated by commas. The final formula looks like this: =TEXTJOIN(", ",TRUE,FILTER($A$4:$A$11,($B$4:$B$11=F4)*($C$4:$C$11=MAXIFS($C$4:$C$11,$B$4:$B$11,F4)))).

Use Modern Dynamic Array Formulas (Recommended)
Dynamic Updates: This formula automatically updates whenever your source sales data changes, making it ideal for live dashboards.
Advanced Spreadsheet Functions

Easily Find Top Data with WPS Spreadsheet

WPS Office Spreadsheet fully supports modern dynamic array functions like FILTER, MAXIFS, and TEXTJOIN. Analyze your sales data, find top-performing products, and effortlessly handle complex data sets.

  1. 1. Open your sales data: Launch WPS Spreadsheet and open the workbook containing your product codes, subcategories, and sales data.
  2. 2. Select the output cell: Click on the target cell where you want to display the top-selling product for your specific subcategory.
  3. 3. Enter the combined formula: Type or paste the TEXTJOIN and FILTER formula: =TEXTJOIN(", ",TRUE,FILTER($A$4:$A$11,($B$4:$B$11=F4)*($C$4:$C$11=MAXIFS($C$4:$C$11,$B$4:$B$11,F4)))).
  4. 4. View the instant results: Press Enter. WPS Spreadsheet will instantly calculate the maximum sales and display the top-selling products, natively handling any ties by separating them with a comma.
Free, lightweight, and fast office suiteFull compatibility with Microsoft Excel formulas and .xlsx formatNative support for modern dynamic array formulas (FILTER, MAXIFS)Cross-platform support for Windows, Mac, Linux, and Mobile
microsoft office alternative - wps office

Frequently Asked Questions

What happens if there are multiple top-selling products with the exact same sales volume?

By using the recommended formula that incorporates TEXTJOIN, the spreadsheet will return all tied product codes in the same cell, separated by a comma (or whichever delimiter you specify).

Why does my MAXIFS formula return a #NAME? error?

The #NAME? error typically occurs if you are using an older version of Excel (2016 or earlier) that does not support the MAXIFS function. You can either use traditional array formulas or use a modern spreadsheet software like WPS Office to resolve this.

Can I find the lowest-selling product using this same method?

Yes. You can simply replace the MAXIFS function with the MINIFS function in your formula to extract the products with the lowest units sold for a specific subcategory.