How to Multiply Values by Percentages Before Using GROUPBY in Spreadsheet
Question details
The user wants to group records by a category column and calculate the sum of values only after multiplying them by a corresponding percentage or probability column.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Calculating a grouped weighted sum or probability-adjusted total across a dataset without adding intermediate calculation columns.
- Observed behavior
- The user needs the correct formula syntax to perform array multiplication within the GROUPBY function to achieve the weighted sum per group.
Ensure that your target value column and percentage column are exactly the same size, and verify that all cells in the percentage column contain valid numeric values rather than text.
Perform Array Multiplication Directly in the GROUPBY Function
You can multiply the value and percentage arrays directly inside the 'values' argument of the GROUPBY function, avoiding the need for a helper column.
The GROUPBY function allows for dynamic array calculations within its arguments. By multiplying the base value array by the percentage array directly in the formula, the function will process the weighted calculation row-by-row before grouping the results by your specified category.
Click on the blank cell where you want the new grouped summary table to be generated.
Type the formula: =GROUPBY(Table1[Type], Table1[Value]*Table1[Perc], SUM). Replace 'Table1[Type]' with your category column, 'Table1[Value]' with your numeric values column, and 'Table1[Perc]' with your percentages column.
Press the Enter key. The spreadsheet will automatically spill the results into the adjacent cells, displaying the unique categories alongside their calculated weighted sums.

Master Data Grouping and Formulas with WPS Spreadsheet
WPS Spreadsheet makes it incredibly simple to analyze complex datasets, perform array calculations, and group data accurately with minimal effort.
- 1. Open your dataset: Launch WPS Spreadsheet and open the workbook containing your raw data.
- 2. Format as Table: Select your dataset and use the 'Format as Table' feature to make your formula ranges dynamic and easier to read.
- 3. Apply advanced functions: Use dynamic array formulas to effortlessly group, sort, and multiply arrays in a single step.
- 4. Format the output: Select your result columns and apply Currency or Accounting number formats via the Home tab for a professional look.

Frequently Asked Questions
Can I use AVERAGE instead of SUM in the GROUPBY function after multiplying?
Yes. You can replace the SUM argument with AVERAGE (e.g., =GROUPBY(Table1[Type], Table1[Value]*Table1[Perc], AVERAGE)) to calculate the average of the multiplied weighted values for each group.
Why am I getting a #VALUE! error when multiplying arrays inside GROUPBY?
This error typically occurs if the two arrays you are multiplying (the value column and the percentage column) are of different lengths, or if one of the columns contains text instead of numbers. Check your ranges to ensure they match exactly.
Do I need to create a helper column to multiply the values first?
No, a helper column is not necessary. The GROUPBY function natively supports dynamic array multiplication within its 'values' argument, keeping your spreadsheet clean and efficient.




