Formatting Issues

Highlight Values That Appear Exactly Three Times in an Excel Row

Nimra MalikNimra Malik Nov 27, 2026 870 views

Question details

Highlight values that occur exactly three times across each row in an Excel range.

Highlight Values That Appear Exactly Three Times in an Excel Row
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user wants to compare values across multiple columns in each row using conditional formatting.
Observed behavior
Values appearing exactly three times in a row should be highlighted; values appearing fewer or more times should remain unhighlighted.
Before you start

Identify the columns and rows to check, and note the top-left cell of the selected range. The example below uses A1:G100, with each row counted independently.

Solution 1Recommended

Create a COUNTIF Conditional Formatting Rule in Excel

Use a formula to highlight each nonblank value that appears exactly three times within its row.

1
Select the range

In the worksheet, select A1:G100, or select your own target range starting from its top-left cell.

2
Create a formula rule

Go to Home > Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.

3
Enter the formula

Enter =AND(A1<>"",COUNTIF($A1:$G1,A1)=3). This counts matching values across columns A through G in the current row and excludes blank cells.

4
Choose a highlight color

Click Format, open the Fill tab, choose a color, and click OK. Click OK again to create the rule.

5
Check the applied range

Go to Home > Conditional Formatting > Manage Rules and confirm that Applies to covers the intended cells, such as =$A$1:$G$100.

Create a COUNTIF Conditional Formatting Rule in Excel
Adjust the references: For a different range, replace $A1:$G1 with the first row's column span and replace A1 with the selection's top-left cell. Keep the column letters in the count range fixed with dollar signs so the rule checks the same columns across each row.
Highlight repeated values in WPS Spreadsheets

Highlight Values Appearing Three Times in WPS Spreadsheets

Use a formula-based conditional formatting rule in WPS Spreadsheets to highlight values that occur exactly three times across each row.

  1. 1. Open the spreadsheet: Open WPS Spreadsheets and use Open to select your workbook.
  2. 2. Select the cells: Select the range to check, such as A1:G100.
  3. 3. Add a formatting rule: Go to Home > Conditional Formatting > New Rule and choose the option to use a formula to determine which cells to format.
  4. 4. Set the formula and format: Enter =AND(A1<>"",COUNTIF($A1:$G1,A1)=3), choose a fill color under Format, and confirm the rule. Adjust the references if your selected range differs.
Highlight exactly three occurrences per row while excluding blanksOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and formatting toolsWork with a free, easy-to-use office suite
microsoft office alternative - wps office

Frequently Asked Questions

Will the rule highlight values that appear twice?

No. The =3 condition highlights a value only when COUNTIF finds exactly three occurrences in the row.

Does the formula count matches across the entire worksheet?

No. COUNTIF($A1:$G1,A1) checks columns A through G in the current row. Adjust the column references to match the range you want to compare.

Why does the formula include A1<>""?

That condition prevents blank cells from being highlighted when exactly three cells in the row are empty.

How do I change the range covered by the rule?

In Excel, go to Home > Conditional Formatting > Manage Rules and edit Applies to. If the columns or starting row change, also edit the formula to match the new range and its top-left cell.