Formatting Issues

Apply Top 12 Conditional Formatting to Each Excel Row

Amos GikundaAmos Gikunda Nov 18, 2026 871 views

Question details

Highlight the 12 largest values separately in each row of an Excel data range.

Highlight the Top 12 Values in Each Excel Row
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains multiple rows of values, and each row needs its own top-12 highlighting.
Observed behavior
A rule applied to the entire data range ranks values across the range instead of evaluating each row separately.
Before you start

Identify the first and last columns of the values to rank, and exclude headers from the selection. The example below uses B2:Z100 and assumes the data contains numbers or blank cells, not errors.

Solution 1Recommended

Use a Formula to Rank Values Within Each Row

Apply one formula-based rule to the full range while keeping each row's ranking independent.

1
Select the data range

Select B2:Z100, starting with B2 so it is the active cell. Replace this example range with your own data range.

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 row-based formula

Enter =IF(COUNT($B2:$Z2)<12,FALSE,IF(ISNUMBER(B2),B2>=LARGE($B2:$Z2,12),FALSE)). Change B and Z to your first and last data columns, and change 2 to the first selected row.

4
Choose the highlighting

Select Format, choose a fill color, and click OK to save the rule.

5
Check the applied range

Open Home > Conditional Formatting > Manage Rules and confirm that Applies to covers the full data range, such as =$B$2:$Z$100.

Use a Formula to Rank Values Within Each Row
Ties and short rows: Ties at the 12th-largest value may highlight more than 12 cells. Rows with fewer than 12 numeric values are not highlighted.
WPS Spreadsheet

Highlight the Top 12 Values in Each Row with WPS Spreadsheet

Use a formula-based conditional formatting rule in WPS Spreadsheet to compare values within each row and highlight those at or above the 12th-largest value.

  1. 1. Open the workbook: Open your Excel workbook in WPS Spreadsheet and select the data range, such as B2:Z100, starting with B2.
  2. 2. Create a rule: On the Home tab, open Conditional Formatting, select New Rule, and choose the option to use a formula.
  3. 3. Enter the formula: Enter =IF(COUNT($B2:$Z2)<12,FALSE,IF(ISNUMBER(B2),B2>=LARGE($B2:$Z2,12),FALSE)), adjusting the columns and first row to match your selection.
  4. 4. Set the format: Choose a fill color in Format, save the rule, and check that it applies to the full selected range.
Rank values separately in each row with one ruleOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with a free Office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my top-12 rule highlight values across multiple rows?

A standard top-items rule ranks its entire applied range. Use Home > Conditional Formatting > New Rule and enter a formula that references only the current row.

Why are more than 12 cells highlighted in a row?

The formula highlights every value equal to or greater than the 12th-largest value. If values tie at that cutoff, more than 12 cells can be highlighted.

What happens if a row has fewer than 12 numbers?

The example formula checks COUNT first and does not highlight that row when it contains fewer than 12 numeric values.

Can I use Format Painter instead?

Yes. Create a top-12 rule for the first row, select that row, and use Home > Format Painter to apply it to each other row one at a time. Check Conditional Formatting > Manage Rules to ensure each rule ranks the intended row.