How to Generate Number Combinations Using Excel Dynamic Array Formulas
Question details
The user needs to generate combinations of values from multiple columns using a Microsoft 365 dynamic array formula without needing an explicit sorting step.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Creating a complete list of combinations by concatenating values from successive columns using modern array functions.
- Observed behavior
- The user wants an efficient formula to spill concatenated combinations across ranges that are already ordered by column, while also seeking a workaround for browser submission issues when posting the formula online.
Ensure you are using a spreadsheet version that supports modern dynamic array functions, such as Microsoft 365 or the latest WPS Office, and verify that the destination cells below your formula are completely empty to prevent #SPILL! errors.
Use TOCOL and TOROW Functions for Dynamic Combinations
Combine values from multiple columns into a single spilled array by nesting dynamic array functions.
The dynamic array functions TOCOL and TOROW can be nested to systematically concatenate arrays. By using the ampersand (&) operator alongside a delimiter (like a hyphen), you can cross-join columns step-by-step.
Because the initial values are already ordered by column, an explicit sorting function is not necessary. The nested formula processes the values natively in the required sequence.
Click on an empty cell where you want the final list of combinations to begin spilling.
Type the formula nesting TOROW for each column you wish to combine. For example, to combine columns A through E, use: =TOCOL(TOROW(TOROW(TOROW(TOROW(A1:A5)&"-"&B1:B5)&"-"&C1:C5)&"-"&D1:D5)&"-"&E1:E7).
Press Enter to execute the formula. Excel will automatically generate the concatenated combinations and spill them down the column.

Troubleshoot Web Forum Submission Issues
Resolve browser-related freezing or rejection when pasting complex formulas into web forms.
Generate Array Combinations Easily with WPS Spreadsheet
WPS Office provides comprehensive support for modern array formulas, allowing you to generate dynamic data combinations, manipulate text, and handle large datasets smoothly with robust formula capabilities.
- 1. Open your data file: Launch WPS Spreadsheet and open the workbook containing your column data.
- 2. Select a starting cell: Click on an empty cell with enough blank rows below it to act as the starting point for your combinations array.
- 3. Input the dynamic formula: Enter the combined TOCOL and TOROW formula corresponding to your data ranges, adding any text delimiters you require.
- 4. Calculate and spill: Press Enter to instantly calculate the results. WPS Spreadsheet will automatically spill the combinations into the adjacent cells.

Frequently Asked Questions
What causes a #SPILL! error when using the TOCOL and TOROW combination formula?
A #SPILL! error occurs when the dynamic array formula needs to populate multiple cells, but one or more of the destination cells are not empty. To fix this, clear the cells below your formula to ensure there is enough space for the combinations to be displayed.
Can I use a different delimiter instead of a hyphen in my combinations?
Yes. You can replace the hyphen ("-") in the formula with any text string you prefer, such as a comma (","), a space (" "), or an underscore ("_"). Just enclose your desired delimiter in quotation marks within the formula.
Are TOCOL and TOROW functions available in older versions of Excel?
No, TOCOL and TOROW are dynamic array functions introduced in Microsoft 365 and newer versions of Excel (such as Excel 2021). If you are using an older version, you may need to use Power Query or VBA macros to generate combinations.
Do I need to sort the data before generating the combinations?
If your source columns are already in the desired order, an additional explicit sorting step (like using the SORT function) is not necessary. The TOCOL and TOROW nesting method processes the ranges sequentially in the order they appear.




