Home > Formulas > Statistical > MIN MAX

Excel MIN IF and MAX IF Formula

Debra Dalgleish - Contextures

In Excel 2016 and earlier, use MIN IF and MAX IF formulas, to find MIN and MAX amounts, based on criteria. Examples and video below, and an Excel file to download.

Tip: For Excel 2019 and later, use MINIFS and MAXIFS functions

Also see: MIN and MAX function basics

max if customer qty

1) MIN and MAX With Criteria

Instead of finding the overall MIN or MAX, you might need to include criteria in your calculations. For example:

  • What is the MIN order total for Binder sales?
  • What is the MAX quantity in the East region?

In this short video, I show how to create MIN and MAX formulas. Next, I show MIN IF and MAX IF formulas using criteria.

There are written steps and examples in the sections below the video.

2) MIN IF Formula

In Excel 2019, new MINIFS and MAXIFS functions were added to Excel.

In earlier versions, you can combine the MIN and IF functions in an array formula, to find a MIN based on criteria.

In this example, we'll find the lowest value for a specific product in a sales list with multiple products. The formula will be entered in cell D2, then copied down to D5.

MIN IF formula

First, enter the MIN and IF functions, and their opening brackets:

  • =MIN(IF(

Next, select the product names in the sales list, and press the F4 key, to lock the reference.

  • =MIN(IF($G$2:$G$17

Type an equal sign, and click on the cell with the product name criteria. This reference will not be locked.

  • =MIN(IF($G$2:$G$17=C2

Type a comma, then select the quantity cells in the sales list. Press the F4 key, to lock this reference.

  • =MIN(IF($G$2:$G$17=C2,$H$2:$H$17

To finish the formula, type two closing brackets, and then press Ctrl+Shift+Enter to array-enter the formula.

  • =MIN(IF($G$2:$G$17=C2,$H$2:$H$17))

MIN IF formula

In the formula in the Formula Bar, shown above, you can see that curly brackets were automatically added at the start and end of the formula, because it was array-entered.

If you don't see those curly brackets, you pressed Enter, instead of Ctrl + Shift + Enter. To fix it, click somewhere in the formula bar, and press Ctrl + Shift + Enter.

Then, copy the formula down, to the rows below, to see the minimum for each of the products.

MIN IF formula copy

3) MAX IF Formula

In Excel 2019, new MINIFS and MAXIFS functions were added to Excel.

In earlier versions, you can combine the MAX and IF functions in an array formula, to find a MAX based on criteria.

In this example, we'll find the highest value for a specific product in a sales list with multiple products.

MAX IF formula

First, enter the MAX and IF functions, and their opening brackets:

  • =MAX(IF(

Next, select the product names in the sales list, and press the F4 key, to lock the reference.

  • =MAX(IF($G$2:$G$17

Type an equal sign, and click on the cell with the product name criteria. This reference will not be locked.

  • =MAX(IF($G$2:$G$17=C2

Type a comma, then select the quantity cells in the sales list. Press the F4 key, to lock this reference.

  • =MAX(IF($G$2:$G$17=C2,$H$2:$H$17

To finish the formula, type two closing brackets, and then press Ctrl+Shift+Enter to array-enter the formula.

  • =MAX(IF($G$2:$G$17=C2,$H$2:$H$17))

MAX IF formula

In the formula in the Formula Bar, shown above, you can see that curly brackets were automatically added at the start and end of the formula, because it was array-entered.

If you don't see those curly brackets, you pressed Enter, instead of Ctrl + Shift + Enter. To fix it, click somewhere in the formula bar, and press Ctrl + Shift + Enter.

Then, copy the formula down, to the rows below, to see the minimum for each of the products.

MAX IF formula copy

4) MAX IF With Multiple Criteria

In the previous example, we found the highest quantity for a specific product, so there was just one criterion -- the product name.

You can also use the MAX IF technique with multiple criteria, by including additional IF functions in the formula. For example, if the data includes a customer name, we could find the highest quantity for each product, for a specific customer.

The customer name is entered in cell D1. In cells C4:C7, the product names are listed.

Enter the following formula in cell D4, and array-enter it, by pressing Ctrl+Shift+Enter. Then, copy the formula down to cell D7.

  • =MAX(IF($H$2:$H$17=C4,IF($I$2:$I$17=$D$1,$J$2:$J$17)))

max if customer qty

  • The formula checks column H for product names that match the entry in cell C4.
  • Then, it checks column I for customer names that match the name in cell D1.
  • For those rows, it finds the highest amount in column J.

5) MAX IF - Latest Product Price

If you have a list of product prices and dates, you can use a formula to find the latest pricing date for a specific product:

Then, use SUMIFS to get the price for that product, on that date.

5.1) Latest Price with MAX/IF Formula

In this example, there is a price list with product, date and price.

price list with dates

To find the latest price for a specific product, start by using MAX and IF, to get the latest date for that product. The product name -- Pens -- is entered in cell A12.

To find the latest pricing date for that product, enter the following formula in cell B12, and press Ctrl + Shift + Enter:

  • =MAX(IF($A$2:$A$9=A12, $B$2:$B$9))

MIN and IF find latest date

Next, to find the price for that product, on that date, enter the following SUMIFS formula in cell C12:

  • =SUMIFS($C$2:$C$9, $A$2:$A$9,A12, $B$2:$B$9,B12)

SUMIFS finds latest price

6) Pivot Table - MIN IF and MAX IF

With some data, an easy way to find the lowest and highest values for a specific item, is to use a pivot table. It automatically creates a list of all the items, and you can show amounts as Min or Max.

This video shows the steps, and there are written instructions below the video.

6.1) Pivot Table MIN IF and MAX IF

In the screen shot below, the TotalPrice field has been added twice to the values area.

From this pivot table, you can quickly see the minimum and maximum amounts based on a product name. For example:

  • MIN IF Bran - 48.62
  • MAX IF Pretzels - 97.65

pivot table shows man and max

6.2) Pivot Table MINIFS and MAXIFS

With a pivot table, you can also see minimum and maximum amounts based on multiple criteria -- like the Excel's new MINIFS and MAXIFS functions. For example:

  • MINIFS East, Bars - 20
  • MAXIFS West, Snacks - 114

pivot table shows man and max with 2 row fields

6.3) Pull MIN and MAX from Pivot Table

If you need to use the Min and Max values from a pivot table in other formulas, use the GetPivotData Function. This video shows how to use the GetPivotData function, and there are written instructions below the video.

6.4) Get MIN IFS and MAX IFS with GETPIVOTDATA

To pull values from a pivot table, use the GetPivotData Function. In this example, you can select a region name in cell A4, and a category name in cell B4.

This formula is in cell C4, to pull the minimum quantity for the selected region and category:

  • =GETPIVOTDATA("Min Qty",$A$7, "Region",A4, "Category",B4)

This formula is in cell D4, to pull the maximum quantity for the selected region and category:

  • =GETPIVOTDATA("Max Qty",$A$7, "Region",A4, "Category",B4)

getpivotdata function pulls values from pivot table

7) Get the Excel Files ✅

  1. Formulas: To see the MIN and MAX formulas, you can download the MIN and MAX sample file. The zipped file is in Excel xlsx format, and does not contain macros.
  2. Pivot Table MIN IF and MAX IF: To see the pivot table MIN IF and MAX IF examples, you can download the Pivot Table MIN MAX sample file. The zipped file is in Excel xlsx format, and does not contain macros.

Get Monthly Excel Tips!

Don't miss my monthly Excel newsletter! You'll get quick tips, article links, and a bit of fun. Add your email, and click Sign Up.

Next, when you get my reply, click the Confirm button. I add this step to protect you from spam!

 

More Tutorials

MINIFS / MAXIFS

MIN / MAX

AVERAGE

CHOOSE

INDEX / MATCH

 

 


Last updated: February 28, 2026 12:03 PM