How to Combine FILTER Results into One Column with TOCOL in Spreadsheet
Question details
The user needs to extract matching data from multiple pairs of columns using criteria, and consolidate the resulting values into a single continuous column.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Filtering related data (like RNTIs and numOfPRB values) spread across different column sets based on a single lookup value, and bringing all matches together into one unified vertical list.
- Observed behavior
- The goal state is to dynamically stack the filtered results side-by-side and then flatten them into one column, successfully ignoring any blank values in the process.
Ensure your spreadsheet software is updated to a version that supports modern dynamic array functions, specifically TOCOL and HSTACK. Familiarize yourself with your table's structure and the exact column names where your criteria and target values reside.
Consolidate Filtered Data Using TOCOL and HSTACK
Use a nested formula combining TOCOL, HSTACK, and FILTER to extract and stack matching values into one column.
This method involves filtering each target column pair individually based on your lookup value. By joining the results horizontally with HSTACK, you create a 2D array of matches. Finally, the TOCOL function transforms this 2D array into a 1D column, filtering out empty cells in the process.
Determine the cell containing your lookup value (e.g., J1) and identify the specific table columns you need to filter (e.g., Table3[numOfPrb-1] and Table3[rnti-1]).
Create the first filter formula: FILTER(Table3[numOfPrb-1], Table3[rnti-1]=J1). Then create the second: FILTER(Table3[numOfPrb-2], Table3[rnti-2]=J1).
Wrap your FILTER formulas inside an HSTACK function to place the results side-by-side: HSTACK(FILTER(...), FILTER(...)).
Enclose the entire HSTACK formula within a TOCOL function. Add '3' as the second argument to ignore blanks and errors: =TOCOL(HSTACK(FILTER(...), FILTER(...)), 3).
Press Enter to apply the formula. The results from all column pairs will dynamically spill into a single, clean column below your selected cell.

Easily Manage Complex Array Formulas with WPS Spreadsheet
WPS Spreadsheet offers robust support for modern dynamic array functions like TOCOL, HSTACK, and FILTER. It provides a highly compatible, free environment to handle advanced data manipulation tasks seamlessly.
- 1. Open your dataset: Launch WPS Spreadsheet and open the workbook containing your scattered column data.
- 2. Select the destination cell: Click on the cell where you want the final consolidated column to begin.
- 3. Enter the nested formula: Input the formula: =TOCOL(HSTACK(FILTER(Range1, Criteria1), FILTER(Range2, Criteria2)), 3).
- 4. Apply and dynamically spill: Press Enter. WPS Spreadsheet will automatically calculate the array and spill the combined results down the column.

Frequently Asked Questions
Why am I getting a #CALC! error when using the FILTER function?
The #CALC! error typically occurs if the FILTER function doesn't find any data matching your criteria. You can handle this by adding the optional [if_empty] argument to your FILTER function, for example: FILTER(range, criteria, "").
Can I use VSTACK instead of HSTACK before using TOCOL?
Yes. VSTACK stacks arrays vertically instead of horizontally. Depending on the shape of your filtered arrays, VSTACK might natively create a single column, though wrapping it in TOCOL ensures the final output remains strictly a 1D column and allows you to easily strip out blank values.
Does the TOCOL function work in older versions of spreadsheet software?
No, TOCOL and HSTACK are modern dynamic array functions. If you are using an older version of Excel or unsupported software, you would need to rely on complex INDEX/MATCH arrays, Power Query, or VBA macros. WPS Office fully supports these modern array functions.
Is there a Python in Excel equivalent for combining these columns?
Yes, in environments supporting Python integrations, you can use pandas DataFrames. You would filter the datasets and concatenate them using pd.concat(). However, traditional dynamic array formulas like TOCOL and HSTACK are often faster and easier to deploy without requiring Python libraries.




