How to Sum Duplicate References and Calculate Split Quantity in Excel
Question details
The user needs to group duplicate reference values, sum their associated quantities, and calculate an evenly split quantity across all matching rows.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Organizing and analyzing datasets containing repeating item references where a total quantity needs to be calculated and evenly distributed among all duplicate entries.
- Observed behavior
- The goal is to automatically sum the values tied to a duplicate reference and divide that sum by the number of occurrences for an equal split.
Ensure your dataset is organized into distinct columns, typically with one column for references (e.g., Column A) and another for quantities (e.g., Column B), with no merged cells that might disrupt formula calculations.
Use SUMIFS and COUNTIF to Calculate the Split Quantity
Combine the SUMIFS function to get the total quantity for a specific reference and divide it by the COUNTIF function to distribute it equally among occurrences.
This dynamic method evaluates the entire column, automatically updating the split quantity if new duplicates are added to the dataset.
Click on the first empty cell in the column where you want the split quantity result to appear (e.g., Cell C2).
Type the formula `=SUMIFS(B:B,A:A,A2)/COUNTIF(A:A,A2)`, assuming Column A contains references and Column B contains quantities.
Press the Enter key to process the calculation for the initial reference.
Click and drag the fill handle (the small square at the bottom-right corner of the selected cell) down to copy and apply the formula to the remaining rows.

Calculate Split Quantities with Unique References and Fixed Ranges
If your data is isolated in a specific range and you have a unique list of references, use absolute cell references with SUMIF and COUNTIF for precision.
Easily Manage Complex Formulas with WPS Spreadsheet
WPS Spreadsheet provides robust formula support, making it incredibly simple to process duplicate data, calculate split quantities, and perform advanced data analysis with zero hassle.
- 1. Open your file in WPS Spreadsheet: Launch WPS Office, open Spreadsheet, and load your dataset containing duplicate references.
- 2. Select a calculation cell: Click on an empty cell next to your references and quantities to begin.
- 3. Enter the formula: Type `=SUMIFS(B:B,A:A,A2)/COUNTIF(A:A,A2)` and press Enter to let WPS immediately compute the split.
- 4. Drag to fill: Hover over the bottom-right corner of the cell and drag downwards to instantly calculate the split quantity for all rows.

Frequently Asked Questions
Can I use the AVERAGE function instead of SUMIFS divided by COUNTIF?
Yes, you can use the AVERAGEIF or AVERAGEIFS function to achieve the exact same result. For example, `=AVERAGEIF(A:A, A2, B:B)` will directly calculate the mean (split quantity) for duplicate references without needing manual division.
Why is my formula returning a #DIV/0! error?
This error occurs if the COUNTIF part of the formula evaluates to zero, meaning it cannot find the reference value. Ensure there are no typos or hidden extra spaces in your reference cells, and that your selected ranges cover the target data accurately.
How do I easily highlight duplicate references before calculating?
You can highlight duplicates by selecting your reference column, navigating to the Home tab, clicking 'Conditional Formatting', and choosing 'Highlight Cells Rules' > 'Duplicate Values'. This helps you visually verify the data you are about to calculate.
What should I do if my quantities are in multiple columns?
If quantities span multiple columns, you cannot use a simple SUMIFS. Instead, you will need to nest multiple SUMIFS statements (e.g., `=SUMIFS(B:B,A:A,A2) + SUMIFS(C:C,A:A,A2)`) and then divide that total by the COUNTIF result.




