Function Problems

How to Sum Demand When Item Codes Match Combined Codes in Spreadsheet

Algirdas JasaitisAlgirdas Jasaitis Nov 11, 2026 869 views

Question details

Summing demand values from a table where item codes are grouped together in single cells separated by commas.

How to Sum Demand When Item Codes Match Combined Codes
Product
Spreadsheet
Device & OS
not provided
Scenario
Consolidating and analyzing data where multiple item codes share the same demand row in a source table.
Observed behavior
The user needs to find individual item codes within combined comma-separated entries and sum their corresponding demand values without using VBA macros.
Before you start

Ensure that your data is cleanly formatted and that the separator used in your combined codes (such as a comma followed by a space) is consistent across all rows.

Solution 1Recommended

Use SUMPRODUCT with ISNUMBER and SEARCH Formula

This robust formula safely identifies exact codes within comma-separated lists and sums their corresponding values, entirely avoiding the need for VBA.

To prevent false partial matches (for example, code 'A' incorrectly matching 'AB' or '1' matching '10'), we append the separator (a comma and space) to the beginning and end of both the search criteria and the lookup range. This guarantees the formula only counts distinct item codes.

1
Identify your data ranges

Locate the cell containing your target individual item code (e.g., D2). Identify the range containing the combined codes in your source table (e.g., A2:A10) and the corresponding demand values (e.g., B2:B10).

2
Enter the SUMPRODUCT formula

Select the cell where you want the calculated total. Enter the following formula: =SUMPRODUCT(--(ISNUMBER(SEARCH(", "&D2&",", ", "&$A$2:$A$10&","))), $B$2:$B$10)

3
Calculate and evaluate

Press Enter to execute the formula. The formula evaluates each row, checks if the exact code exists in the combined string using the SEARCH function, and sums the matching demand values.

4
Apply to other item codes

Click the bottom-right corner of the formula cell and drag the fill handle down to apply the formula to the remaining individual item codes in your summary table.

Use SUMPRODUCT with ISNUMBER and SEARCH Formula
Formula Compatibility: This array-based formula functions flawlessly without requiring Ctrl+Shift+Enter in modern versions of WPS Spreadsheet and Excel, automatically updating your sums if the source demand values change.
Advanced Data Processing

Efficiently Sum Complex Data with WPS Spreadsheet

WPS Spreadsheet offers powerful formula processing engines that handle complex array operations and wildcards seamlessly, allowing you to extract and sum data from combined cells effortlessly.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your item codes and demand tables.
  2. 2. Apply the calculation: Select your target cell and input the SUMPRODUCT formula provided in the solution.
  3. 3. Process the data: Press Enter to instantly calculate the total demand, and use the drag-fill tool to complete your summary table.
Fully compatible with Microsoft Excel formulas like SUMPRODUCT and SUMIFSFree, lightweight, and fast spreadsheet processingSupports advanced data analysis without requiring complex VBA coding
microsoft office alternative - wps office

Frequently Asked Questions

How can I avoid false matches when summing combined item codes?

To prevent a code like '1' from matching '10', you must wrap your search criteria and your lookup text in delimiters. By searching for ", 1, " within ", "&Combined_Range&", ", you ensure that only the exact standalone code is identified and matched.

Why does my standard SUMIF wildcard formula return incorrect totals?

A standard SUMIF formula using wildcards (e.g., "*"&Code&"*") will blindly match sequences of text. If you search for 'A', it will also count rows containing 'AB' or 'CA', inflating your totals. Use the SUMPRODUCT and SEARCH method with padded commas to resolve this.

Is VBA absolutely necessary for splitting and summing comma-separated text?

No, VBA is not required. Modern spreadsheet array formulas (like SUMPRODUCT combined with ISNUMBER and SEARCH) or data manipulation tools like Power Query can dynamically handle comma-separated strings natively.