How to Highlight the Highest Values Within Each Group in Excel
Question details
The user needs to identify and highlight the highest allocation proportions within specific categories (courses), including values that fall within a 0.1 difference threshold from the maximum value of that category.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Applying conditional formatting to a dataset to visually flag top-performing records within distinct groups, while allowing a predefined variance threshold (e.g., within 0.1 of the group's maximum).
- Observed behavior
- The user is unsure how to configure the formatting logic to compare each value against the maximum of its specific group, especially regarding how to handle edge cases where the variance threshold is not met.
Ensure your data is organized with clear column headers for categories (like courses) and values. Verify the exact logical threshold you want to apply, as incorrect variance logic will highlight the wrong cells.
Apply Conditional Formatting Using a Custom Formula
Use a custom formula in Conditional Formatting to dynamically find the maximum value per course and highlight values within your 0.1 threshold.
By combining the MAX and IF functions within a conditional formatting rule, Excel can evaluate each row's value against the maximum value of its specific group.
Highlight the range of cells containing the values you want to format (e.g., B2:B100). Ensure the active cell is the top cell of your selection.
Go to the 'Home' tab on the Excel ribbon, click on 'Conditional Formatting', and select 'New Rule' from the dropdown menu.
Choose 'Use a formula to determine which cells to format'. Enter the formula: =B2>=(MAX(IF($A$2:$A$100=A2,$B$2:$B$100))-0.1). This assumes Column A contains the course names and Column B contains the values.
Click the 'Format' button, navigate to the 'Fill' tab, choose a highlight color, and click 'OK' twice to apply the rule to your dataset.

Use a Helper Column with MAXIFS
If complex conditional formatting formulas slow down your workbook or are difficult to troubleshoot, use a helper column to calculate the group maximum first.
Easily Highlight Conditional Data with WPS Office
WPS Spreadsheet provides a powerful, user-friendly interface for applying complex conditional formatting rules. You can easily highlight top values within groups using built-in features and full support for advanced formulas.
- 1. Open your file: Launch WPS Office and open your spreadsheet containing the categorized data.
- 2. Select the data: Highlight the column or specific cells where you want the formatting to appear.
- 3. Access Conditional Formatting: Navigate to the 'Home' tab and click on the 'Conditional Formatting' icon.
- 4. Create a New Rule: Select 'New Rule', choose the formula option, and input your threshold formula to instantly highlight your data.

Frequently Asked Questions
Why is my conditional formatting formula highlighting the wrong cells?
This usually happens due to incorrect cell referencing. Ensure your formula uses absolute references for the lookup ranges (e.g., $A$2:$A$100) and relative references for the current row's criteria (e.g., A2). Also, ensure the active cell when creating the rule matches the relative reference in your formula.
Can I highlight the top 3 values in each group instead of using a difference threshold?
Yes, but it requires a different formula using the LARGE function combined with an IF array. You would use a formula like =B2>=LARGE(IF($A$2:$A$100=A2,$B$2:$B$100),3) in your conditional formatting rule.
How do I change or remove the highlight color later?
Go to the Home tab, click Conditional Formatting, and select 'Manage Rules'. Choose 'This Worksheet' from the dropdown at the top, select your rule, and click 'Edit Rule' to change the color, or 'Delete Rule' to remove it entirely.




