Function Problems

How to Search Excel Data, Highlight Words, and Count Matches

Kushani NimanthikaKushani Nimanthika Nov 2, 2026 870 views

Question details

The user wants to filter spreadsheet rows by a search term, count the total matches, and highlight the specific matched words within cells.

How to Search Excel Data, Highlight Specific Words, and Count Matches
Product
Excel
Device & OS
not provided
Scenario
Searching and analyzing text data in spreadsheets to find occurrences of specific words and make them visually stand out for easier reading.
Observed behavior
Standard conditional formatting highlights the entire cell instead of just the matching text, requiring alternative methods like VBA and specific formulas to achieve the desired result.
Before you start

Before using VBA macros to highlight text, ensure your spreadsheet is saved as a Macro-Enabled Workbook (.xlsm) and that macros are enabled in your security settings.

Solution 1Recommended

Use Formulas to Filter Data and Count Word Matches

Use wildcard formulas like COUNTIF or SUMPRODUCT to easily count occurrences of a specific word across your dataset, and apply AutoFilter to view the results.

1
Set up a search cell

Select a designated empty cell (for example, A1) to act as your dynamic search input box.

2
Count the matches

To count occurrences containing the searched word, enter the formula =COUNTIF(Range, "*"&A1&"*") where 'Range' is the group of cells you want to search.

3
Filter the rows

Select your data headers, go to the 'Data' tab, and click 'Filter'. Click the dropdown arrow on your target column, select 'Text Filters', then 'Contains...', and enter your search term to hide non-matching rows.

Wildcard searching: Using asterisks (*) around your search reference ensures that Excel counts the word even if it is surrounded by other text inside the cell.
Efficient Data Search with WPS Office

Easily Search, Filter, and Highlight Data in WPS Spreadsheet

WPS Spreadsheet offers powerful built-in tools for data filtering, conditional formatting, and formula calculations. It fully supports VBA macros, allowing you to run custom scripts to highlight specific words within cells just like you would in Microsoft Excel.

  1. 1. Open your data: Open your spreadsheet in WPS Office and select the data range you wish to search.
  2. 2. Apply filters: Go to the 'Data' tab and click 'AutoFilter' to easily filter rows by your specific search term.
  3. 3. Count or highlight: Use the =COUNTIF() function to count text matches, or access the 'Developer' tab to run your text-highlighting VBA script.
Fully compatible with Microsoft Excel file formats (.xlsx, .xlsm, .csv).Supports advanced functions like COUNTIF, SUMPRODUCT, and wildcards.Includes a built-in VBA editor for running custom macro scripts seamlessly.Free and lightweight alternative for fast and professional data analysis.
microsoft office alternative - wps office

Frequently Asked Questions

Why does conditional formatting highlight the whole cell instead of just the word?

Standard conditional formatting evaluates the cell value as a whole. If the condition is met, the formatting rules are applied to the entire cell background or font. To format only a specific part of the text within a cell, you must use a VBA macro.

How do I count partial text matches in a range?

You can use the COUNTIF function combined with asterisks as wildcards. For example, =COUNTIF(A2:A100, "*apple*") will count any cell in the range that contains the word 'apple', regardless of what text comes before or after it.

Can I filter data based on a cell value dynamically?

Yes, you can use Excel's Advanced Filter feature or set up a VBA Worksheet_Change event to automatically hide rows that do not match the search term entered in your designated input cell.