How to Count Matching Text in Specific Columns Across a Horizontal Excel Range
Question details
The user wants to count the occurrences of specific text within individual columns across a broad horizontal data range and transpose the results into a vertical list.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Transposing a horizontal dataset into a vertical search list to count partial text matches separately in each source column.
- Observed behavior
- The user needs an efficient formula to automate column-by-column text counting without relying on complex, nested legacy functions or converting the data into an Excel Table.
Ensure your data is organized in a clear horizontal range and identify the target cell containing the specific text you want to search for. Check that your spreadsheet software supports dynamic array functions like LET, BYCOL, and LAMBDA if you plan to use the modern array approach.
Use Dynamic Array Functions (BYCOL, LAMBDA, and LET)
This modern approach uses dynamic arrays to efficiently process and count text matches column by column, transposing the result automatically into a vertical list.
This method leverages the BYCOL function to iterate through each column, the SEARCH function for partial, case-insensitive matching, and TRANSPOSE to output the results vertically.
Identify your horizontal source data range (e.g., F4:AAA100) and the cell containing your search text (e.g., $B$2).
In your target cell, enter the following formula: =LET(data,F4:AAA100,TRANSPOSE(BYCOL(data,LAMBDA(c,SUM(--ISNUMBER(SEARCH($B$2,c))))))).
If you need case-sensitive or exact matching, replace the SEARCH function with EXACT in the formula: =LET(data,F4:AAA100,TRANSPOSE(BYCOL(data,LAMBDA(c,SUM(--EXACT($B$2,c)))))).

Use Legacy Functions (COUNTIF with INDEX)
If your software version does not support dynamic arrays, you can use a combination of legacy functions to achieve similar results, though it requires copying the formula manually.
Count and Analyze Complex Data Easily with WPS Spreadsheet
WPS Spreadsheet fully supports advanced array formulas, enabling you to process large horizontal datasets, transpose data dynamically, and utilize functions like BYCOL and LAMBDA seamlessly without lag.
- 1. Open WPS Office: Launch WPS Office and open your workbook in the WPS Spreadsheet application.
- 2. Select target cell: Click on the cell where you want your vertical list of counts to begin.
- 3. Enter the array formula: Paste the =LET(...) array formula provided in the solution into the formula bar and press Enter.
- 4. Verify results: The results will automatically spill vertically downward, accurately counting the matching text for each individual column.

Frequently Asked Questions
Why does the SEARCH function return a #VALUE! error when the text is not found?
The SEARCH function natively returns a #VALUE! error when it doesn't find the specified text. Wrapping it in ISNUMBER() converts valid findings to TRUE (1) and errors to FALSE (0), allowing the SUM function to aggregate the count properly without failing.
Can I make the text search case-sensitive in the array formula?
Yes. By default, the SEARCH function is case-insensitive. To perform a case-sensitive search, simply replace the SEARCH function with the FIND function in your LAMBDA formula.
What if my version of Excel or WPS Spreadsheet doesn't support the LAMBDA or BYCOL functions?
If dynamic array functions are not available in your current version, you can use traditional functions like COUNTIF combined with INDEX and ROW. For example, using =COUNTIF(INDEX($F$4:$AAA$100, 0, ROW(A1)), "*"&$B$2&"*") and dragging it down vertically will achieve the same column-by-column counting.




