Formatting Issues

Highlight Row Maximum and Lowest Nonzero Values in Excel

Adam DavisAdam Davis Dec 2, 2026 868 views

Question details

Highlight the maximum and lowest nonzero numeric values in each row without creating separate rules for every row.

Highlight the Maximum and Lowest Nonzero Values in Each Excel Row
Product
Microsoft Excel
Device & OS
not provided
Scenario
A large table needs two conditional formatting rules applied across all data rows.
Observed behavior
Each row's maximum and lowest nonzero values should receive distinct formatting automatically.
Before you start

Identify the first data cell and the full data range, excluding headers. The examples below use B2:CW201; adjust both the formulas and the selected range to match your table.

Solution 1Recommended

Create Two Formula-Based Conditional Formatting Rules in Excel

Apply two rules to the entire table so Excel evaluates the values separately for each row.

The dollar signs fix the row's boundary columns while the row number and tested cell reference adjust across the selected range. The lowest-nonzero rule includes negative values.

1
Select the data range

Select B2:CW201, with B2 as the active cell. Replace this example range with your own data range.

2
Add the maximum rule

Go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter =AND(ISNUMBER(B2),B2=MAX($B2:$CW2)), choose Format, select a fill color, and click OK.

3
Add the lowest nonzero rule

With the same range selected, create another formula-based rule. Enter =AND(ISNUMBER(B2),B2<>0,B2=MINIFS($B2:$CW2,$B2:$CW2,"<>0")), choose a different fill color, and click OK.

4
Check the rule ranges

Open Home > Conditional Formatting > Manage Rules and confirm that both rules apply to =$B$2:$CW$201, or to your equivalent full data range.

Create Two Formula-Based Conditional Formatting Rules in Excel
Ties and overlapping rules: All tied values are highlighted. If a value is both the maximum and the lowest nonzero value, both rules may apply; use Manage Rules to adjust their order and formatting priority.
Work with spreadsheets in WPS Office

Highlight Row Extremes in WPS Spreadsheet

Use formula-based conditional formatting in WPS Spreadsheet to highlight each row's maximum and lowest nonzero value across a selected table.

  1. 1. Open and select the table: Open your workbook in WPS Spreadsheet and select the data range, such as B2:CW201, with B2 as the active cell.
  2. 2. Create the maximum rule: On the Home tab, open Conditional Formatting and create a formula-based rule using =AND(ISNUMBER(B2),B2=MAX($B2:$CW2)). Choose a fill color.
  3. 3. Create the lowest nonzero rule: Add a second formula-based rule using =AND(ISNUMBER(B2),B2<>0,B2=MINIFS($B2:$CW2,$B2:$CW2,"<>0")) and choose a different fill color.
  4. 4. Verify the result: Use Conditional Formatting > Manage Rules to check that both rules cover the full table, then save the workbook.
Apply row-based highlighting without creating a rule for every rowOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceGet started with WPS Office for free
microsoft office alternative - wps office

Frequently Asked Questions

Will the rules highlight negative numbers?

Yes. The lowest-nonzero formula uses the criterion "<>0", so negative numbers are included. To highlight the lowest positive value instead, change the criterion to ">0" and replace B2<>0 with B2>0.

What happens when a row contains only zeros or blank cells?

The lowest-nonzero rule highlights nothing because there is no qualifying value. The maximum rule can highlight numeric zeros, but its ISNUMBER check prevents blank cells from being highlighted.

Why are several cells highlighted in the same row?

Conditional formatting highlights every value that matches the row's maximum or lowest nonzero value. If there are ties, multiple cells receive the same formatting.

How do I apply the rules to a different table size?

Select your data range before creating the rules, replace B2 with its first cell, and replace $B2:$CW2 with the first row's actual boundaries. Check the full range under Home > Conditional Formatting > Manage Rules.

What if Excel does not recognize MINIFS?

MINIFS is available in Excel 2019 and later and Microsoft 365. If your version does not support it, update Excel or use a compatible alternative formula.