Formatting Issues

Highlight All Matching Company Rows with Conditional Formatting in Excel

Bushra ParveenBushra Parveen Dec 2, 2026 869 views

Question details

Automatically highlight every row for a company when an x is entered in any one of that company's rows.

Highlight All Matching Company Rows with Conditional Formatting in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains multiple rows per company and a column where a row can be marked with x.
Observed behavior
All rows with the same company name should be highlighted whenever at least one of them has an x in the marker column.
Before you start

Identify the company-name column, the marker column, and the first and last data rows. The example below uses company names in column B, markers in column C, and data in rows 2 through 100.

Solution 1Recommended

Create a COUNTIFS conditional formatting rule in Excel

Use this rule to highlight every row for a company when any matching row has an x in column C.

COUNTIFS checks all company names in B2:B100 and markers in C2:C100. The fixed ranges stay the same, while $B2 changes to the company name on each formatted row.

1
Select the data rows

Select the cells to highlight, such as A2:D100. Start the selection on row 2 and exclude the header row.

2
Create a formula rule

On the Home tab, select Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.

3
Enter the formula

In the formula box, enter =COUNTIFS($B$2:$B$100,$B2,$C$2:$C$100,"x")>0. Adjust the columns and row limits to match your data, and make sure $B2 refers to the first row of the selected range.

4
Choose the highlight

Select Format, choose a fill color on the Fill tab, and select OK. Select OK again to save the rule.

5
Test the rule

Enter x in column C for one company row. Check that every selected row with the same company name is highlighted.

Create a COUNTIFS conditional formatting rule in Excel
Check the rule range: If you add rows beyond row 100, update both COUNTIFS ranges and the Applies to range under Home > Conditional Formatting > Manage Rules.
Highlight matching rows in WPS

Highlight Company Rows in WPS Spreadsheet

Use a formula-based conditional formatting rule in WPS Spreadsheet to highlight all rows for a company when one row is marked with x.

  1. 1. Open and select the data: Open the workbook in WPS Spreadsheet and select the data range to highlight, such as A2:D100.
  2. 2. Add a formatting rule: On the Home tab, open Conditional Formatting and choose New Rule. Select the option to use a formula to determine which cells to format.
  3. 3. Enter the formula: Enter =COUNTIFS($B$2:$B$100,$B2,$C$2:$C$100,"x")>0, adjusting the columns and row limits for your worksheet.
  4. 4. Set the fill and test: Choose a fill color in Format, confirm the rule, and enter x in the marker column for a company to test the highlighting.
Highlight all matching company rows automaticallyEdit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why is only the marked row highlighted?

Check that the formula uses COUNTIFS over the full company and marker ranges, not just the current row. In Excel, open Home > Conditional Formatting > Manage Rules to inspect the formula and Applies to range.

Will an uppercase X trigger the rule?

Yes. COUNTIFS text comparisons are not case-sensitive, so both x and X match the criterion "x".

How do I include new rows in the rule?

In Home > Conditional Formatting > Manage Rules, extend the Applies to range and both formula ranges to cover the new rows. Keep the row numbers aligned across the company and marker ranges.

What happens when I remove the x?

The highlighting disappears for that company if none of its other rows in the checked marker range contains an x.

Can I use different columns for company names and markers?

Yes. Replace both B references with the company-name column and replace the C range with the marker column. Keep the current-row reference aligned with the first row of the selected formatting range.