How to Group Similar Products Together in Excel
After entering the Excel data, products of the same type are often scattered across different rows. This article explains how to first standardize the category column, then use sorting, filtering, or PivotTables to group rows of the same type together, and provides methods for verifying the results.
Key points of this article
- The premise for grouping is that every row has a category column with consistent spelling; if categories are crammed into product names, split them out first.
- To simply make rows of the same category adjacent, sort by the category column; to view each category in turn without disturbing the original table, use filtering.
- To count or total amounts per category, use a PivotTable, which does not change the order of the original data.
- Back up before sorting, and select the complete data range, otherwise data will become misaligned.
- After organizing, verify with three methods—row counts, totals, and spot checks—to confirm nothing is missing or misaligned.
Many people only discover after entering an Excel spreadsheet that products of the same type are scattered everywhere: phone accessories and computer accessories are mixed together, and item numbers of the same category are dozens of rows apart. Picking them out row by row is both slow and prone to omissions. This situation is very common in sales records, inventory lists, and quotation sheets.
This one is aimed at people who need to organize tables like this. The core idea is simple: first make "category" a separate column and standardize how it is written, then use sorting, filtering, or a pivot table so that rows of the same kind end up together or get summarized. After reading, you will be able to follow the steps to produce a clearly grouped table and know how to check the results.
This is a general data-cleaning method, unrelated to file format conversion. Whether the data was entered manually or copied from other files, these steps can be applied.
How to group similar products together in Excel? One-sentence answer
One-sentence conclusion: First make sure every row has a category field with consistent spelling, then sort by that field; when you need counts, use filtering or a PivotTable.
| Your situation | Recommended Practices | Cause |
|---|---|---|
| I just want to see similar rows grouped together. | Sort in ascending order by category | Fast, without changing the data structure |
| Need to review category by category while keeping the original table. | Turn on AutoFilter and select by category | Without changing the original order, switch at any time. |
| Count or sum the amounts for each category. | Insert PivotTable | Automatic grouping and summarizing, no manual calculation needed |
| The category names are inconsistent in format, for example "phone case" and "phone case " (note the trailing space). | First unify the names, then categorize. | Otherwise, similar items would be split into multiple groups. |
| Subtotal needs to be added under each category. | Sort first, then use subtotals. | Subtotals depend on the order already arranged. |
Before You Begin: Confirm These Points First
- Is the category in its own column? If the product name, model, and category are crammed into the same cell, sorting cannot compare by category. You need to split them first, or add a "Category" column and fill it in manually. The reason is that sorting can only work on the values of a single column.
- Whether the same category is spelled consistently. "headphones" and "headphones " (with an extra trailing space) are treated as two separate categories in a table, and so are "Earphone" and "headphones". The reason is that sorting and aggregation both judge by the literal value.
- Is the header in the first row, and are there any blank rows in between? Blank rows split the data into two sections, so sorting only applies to one of them. The reason is that sorting usually works on a continuous data range.
- Whether the data comes from a PDF. If the category table was originally a PDF, you can first export it to Excel in the OmniDoc desktop client before you start organizing it. After exporting, you still need to check it against the original, because layout conversion may leave some columns misaligned.
- Whether the original table has been backed up. Once the sorted order is saved, it is very difficult to restore the original arrangement. Before you begin, save a copy of the file and perform all operations on the copy.
Steps to group products of the same category in Excel
- Back up the original sheet and work on a copy. If you make a mistake, you can go straight back to the original data.
- Check the category column and standardize the spelling. Use Find and Replace or edit manually to unify variants such as "phone case" and "phone case " into a single name.
- Select the complete data range, including the header row. If you select only the category column, the other columns will become disconnected from the categories, and the product information will no longer line up.
- Sort in ascending order using the category column as the primary key. Rows of the same category will be placed next to each other. If you also want prices to be arranged in order within each category, add a secondary key.
- Turn on the filter and review each category one by one. Enable AutoFilter on the header row, then select each category in turn and confirm that rows of the same category are grouped together.
- Insert a PivotTable when you need to summarize data. Drag the category field to the Rows area and the quantity or amount field to the Values area to see the summary results for each category.
- When subtotals are needed, use Subtotal (Data → Subtotal). Always sort the data first before subtotaling; otherwise the subtotal rows will be scattered throughout the table.
- Save as a new file. Keep the version from before the cleanup so you can compare them later.
Verify item by item after completion
| Inspection item | How do you look at it? | What should I do if I have a problem? |
|---|---|---|
| Are same-class rows adjacent? | Check the boundaries of each category group one by one | Return to the category column, find inconsistently written values, and standardize them. |
| Is the data misaligned? | Spot-check a few rows and verify the product numbers and prices | Redo it using a copy made before sorting, and confirm whether only some of the columns were selected. |
| Does the total add up? | Compare with the original table's total row count and total amount | Check for blank lines, numbers stored as text, or duplicate rows |
| Are the category names consistent? | Open the filter dropdown list and view all category items | Merge duplicates, then re-sort or refresh the PivotTable |
| No missing rows | Compare the line counts before and after cleanup | Check whether the table range includes all the data |
If the data comes from a PDF, the key figures must also be checked item by item against the original document.
📊 Core Comparison: How to Choose Between Sorting, Filtering, and Pivot Tables
| Method | Suitable scenarios | Will it change the original table's order? | Difficulty: Advanced |
|---|---|---|---|
| Sorting | Only same-type rows need to be adjacent | Meeting | Low |
| Filter | Browse by category, switching occasionally | Can't / I don't know how to | Low |
| Pivot table | Count or sum amounts by category | Not possible; generate a separate summary table. | Chinese |
If you only need to look at the data temporarily, filtering is the quickest option. For ongoing statistical analysis, a PivotTable is recommended, and you should refresh it once whenever the source data changes.
❓ Frequently Asked Questions (FAQ)
1. My data got scrambled after sorting. What should I do?
Most likely only one column was selected for sorting, so the other columns didn't move along with it. Replace the current table with the backup copy, or simply undo, then select the complete data range and sort again.
2. When the same product belongs to two categories, which category should it be assigned to?
First, select one primary category and place it in the "Primary Category" column. If another classification is needed, add a separate column called "Secondary Category". When computing statistics, use only the primary category to avoid counting the same row twice.
3. How do I display category names when the categories are stored as numeric codes?
First create a lookup table that maps codes to names, then use a lookup function (such as VLOOKUP) to match each code to its name, and finally group the data by name. Save the mapping table separately so that new codes can be added to it later.
4. Why can't I see a certain category in the PivotTable?
There are three common causes: there are extra spaces in the category entries; rows were added to the source data after the pivot table was created, but the data source range was not updated; or the category cells are blank. After checking these, simply refresh the pivot table.
5. What should you watch out for when organizing tables with free tools?
You can focus on a few points: whether there are limits on file size and number of rows; whether exported files carry watermarks; whether sensitive product or customer data is uploaded to third-party servers; and whether layout, formulas, and formatting are fully preserved. These points apply to all tools and are unrelated to any specific product.
📝 Summary
To group similar products together in Excel, the key is to first standardize the spelling of the category column, then organize the data by sorting, filtering, or using a PivotTable. Back up the data before tidying it, and check each item after tidying, so the results are more reliable.


