Function Problems

How to Find Text in a Range and Return Row and Column Data in Excel

Amos GikundaAmos Gikunda Nov 10, 2026 869 views

Question details

The user needs to search a specific cell range for text values and automatically extract the corresponding row labels, column headers, and associated dates into an organized format.

How to Find Text in a Range and Return Its Row and Column Data in Excel
Product
Excel
Device & OS
not provided
Scenario
Extracting matrix-style data (such as employee schedules or status trackers) into a flat list format so that the data can be easily filtered and sorted on another worksheet.
Observed behavior
The user is looking for a streamlined method to dynamically return associated row and column headers alongside cell values without having to search manually or drag formulas down multiple rows and columns.
Before you start

Ensure that your row labels and column headers are clearly defined in your worksheet and that your version of Excel or WPS Spreadsheet supports dynamic array formulas.

Solution 1Recommended

Use a Dynamic Array Formula to Spill Results

Apply a single dynamic array formula to automatically extract and concatenate the row labels, column headers, dates, and cell values for the entire range.

This approach uses the IF function combined with text concatenation (&) to evaluate the entire range at once. If a cell is not empty, it strings together the corresponding row data, column headers, formatted dates, and the cell's actual text.

Because it is a dynamic array formula, it automatically 'spills' the results into adjacent cells. You only need to type the formula into one cell without needing to manually copy it down or across.

1
Select the destination cell

Click on the top-left cell in the destination worksheet where you want the extracted list to start appearing.

2
Enter the dynamic formula

Type the following formula into the formula bar: =IF(C6:X14="","",B6:B14&" - "&C3:X3&" - "&TEXT(C4:X4,"mm/dd/yyyy")&" - "&C6:X14)

3
Apply the formula

Press Enter. The formula will automatically calculate and spill the concatenated results for all non-empty cells found in the target range.

4
Adjust references as needed

Modify the range references in the formula (e.g., change C6:X14 for the main search area, B6:B14 for row labels, and C3:X3 for headers) to correctly match the layout of your specific dataset.

Use a Dynamic Array Formula to Spill Results
Understanding Dynamic Arrays: Dynamic array formulas require a modern spreadsheet application like Microsoft 365, Excel 2021, or WPS Office. If you encounter a #SPILL! error, it means the destination cells are not empty. Clear the blocking cells to display the results.
Free Spreadsheet Software

Use WPS Spreadsheet to Quickly Extract Range Data

WPS Spreadsheet fully supports dynamic array formulas, allowing you to easily extract row and column data from large ranges. Manage your complex datasets efficiently with its powerful calculation engine and user-friendly interface.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing your matrix data.
  2. 2. Select a target cell: Click on an empty cell in a new worksheet where you want to gather your extracted data.
  3. 3. Input the array formula: Type the provided =IF() dynamic array formula, making sure to reference your specific row and column ranges.
  4. 4. View your results: Press Enter to instantly spill your extracted row labels, headers, and text values into an organized list.
Fully compatible with Microsoft Excel formulas and dynamic arraysFree and lightweight alternative to heavy spreadsheet programsAdvanced filtering and data extraction tools built nativelySeamless transition with a familiar user interface
microsoft office alternative - wps office

Frequently Asked Questions

Why am I getting a #SPILL! error when using the formula?

A #SPILL! error occurs when the dynamic array formula does not have enough empty cells to display all the resulting data. To fix this, locate the destination range and clear any existing data, text, or spaces blocking the formula so it can expand freely.

How can I extract data if I only want to find a specific text string instead of all non-empty cells?

To search for a specific text string instead of any non-empty cell, change the condition inside the IF formula. For example, use =IF(C6:X14="Completed", B6:B14&" - "&C6:X14, "") to only return the row and column data for cells that contain the exact word 'Completed'.

Can I separate the extracted data into different columns instead of one combined string?

Yes. While the concatenation method (&) groups everything into a single cell, you can use the built-in 'Text to Columns' feature under the Data tab to split the spilled string by the hyphen delimiter. Alternatively, advanced users can use functions like HSTACK or CHOOSECOLS to output the row headers, column headers, and cell values into distinct columns directly.