HomeGoogle DocsSpreadsheetHow to Highlight the Min Value in Each Group in Google Sheets

How to Highlight the Min Value in Each Group in Google Sheets

Published on

This post contains two conditional format rules to highlight the min value in each group in Google Sheets.

Assume you have a Sheet containing a player list entered in columns A (name), B (age), and C (country name).

If you want to find the min age of players by country name, you can use a conditional format rule.

The rule will locate and highlight the min age in column B by grouping the country name in column C.

But for the explanation purpose, I am using a sample dataset that contains a list of fruit names and their quantity.

We will use the formula to highlight min quantity w.r.t. of each fruit.

Formula to Highlight the Min Value in Each Group in Google Sheets

Please see our sample data in A2:B20 and the highlighting applied in B2:B20.

Highlight the Min Value in Each Group in Google Sheets

As per my method, we require two conditional format rules to highlight the min value in each group in Google Sheets, and here are them.

Rule # 1:

=isblank($B2)=true

Rule # 2:

=B2=MIN(FILTER($B$2:$B$20, $A$2:$A$20=A2))

How Do I Apply the Above Rules to Highlight the Min Value in Each Group?

  1. Select B2:B20.
  2. Go to Format > Conditional formatting.
  3. Copy Rule # 1 above and paste it into the blank field under Format cells > Custom formula. Choose “White” fill color.
  4. Copy Rule # 2 above. Select “Add another rule” and paste it into the designated field, possibly overwriting Rule # 1. Select “Orange” fill color.
  5. Select Done.
Two Rules in the Conditional Format Panel (Their Order)

This way, we can apply the conditional format rule to highlight the lowest (min) value in each category (group) in Google Sheets.

Anatomy of the Highlight Rules

We will see Rule # 2 first which highlights the min value in each group.

In the first row in the range A2:B20, the FILTER filters B2:B20 (quantity) wherever A2:A20 (fruit names) matches A2 (“apple”).

The purpose is to filter all the quantities corresponding to “apple.”

So the result would be 100, 255, and 125.

=FILTER($B$2:$B$20, $A$2:$A$20=A2)

Using MIN, we find the min value of the first group (“apple”), which is 100.

In the second row, the formula will automatically become =FILTER($B$2:$B$20, $A$2:$A$20=A3), and in the third row =FILTER($B$2:$B$20, $A$2:$A$20=A4).

So the min value in the first three rows will be 100 as A2, A3, and A4 contain “apple” as the criterion.

So the rule will become =B2=100, B3=100, and =B4=100 in the first three rows.

It evaluates to TRUE in B2, so the formula fills B2 with the “Orange” color.

The same applies to other groups (categories) in the range.

The purpose of Rule # 1 is to highlight any blank cells in the min column with the “White” fill color.

It supersedes Rule # 2. It’s necessary because the first rule will highlight all blank cells in the range with the “Orange” color.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Appointment Schedule Template in Google Sheets

An appointment schedule template in Google Sheets can assist you in efficiently managing your...

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

More like this

Appointment Schedule Template in Google Sheets

An appointment schedule template in Google Sheets can assist you in efficiently managing your...

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.