Apply Top 12 Conditional Formatting to Each Excel Row
Question details
Highlight the 12 largest values separately in each row of an Excel data range.

- 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.
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.
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.
Select B2:Z100, starting with B2 so it is the active cell. Replace this example range with your own data range.
On the Home tab, select Conditional Formatting > New Rule, then choose Use a formula to determine which cells to format.
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.
Select Format, choose a fill color, and click OK to save the rule.
Open Home > Conditional Formatting > Manage Rules and confirm that Applies to covers the full data range, such as =$B$2:$Z$100.

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. Open the workbook: Open your Excel workbook in WPS Spreadsheet and select the data range, such as B2:Z100, starting with B2.
- 2. Create a rule: On the Home tab, open Conditional Formatting, select New Rule, and choose the option to use a formula.
- 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. Set the format: Choose a fill color in Format, save the rule, and check that it applies to the full selected range.

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.




