# Max If (Max Value with Condition) – Excel & Google Sheets

This tutorial will demonstrate how to find the largest value which meets specific conditions in Excel and Google Sheets. ## MAXIFS Function

Users of Google Sheets and Excel 2019 or later can use the single MAXIFS Function .

This example uses the MAXIFS and DATE Functions to show the largest Order Size for each Store Name for Order Dates before 4/30/2021: The MAXIFS Function does not require the user to press CTRL + SHIFT + ENTER when entering the formula.

## Max If Array Function

If you don’t have access to the MAXIFS Function, you can create an Array Formula to simulate the MAXIFS Function. We will walk through this below.

The MAX Function identifies the largest value in a series of numbers. We can use the MAX Function combined with an IF Function to identify the largest value that meets a specified condition.

This example will use the MAX and IF Functions in an array formula to identify the largest Order Size for each Store Name In Office 365 and versions of Excel after 2019, you can simply enter the above formula like you normally would (by pressing ENTER).

However, for Excel 2019 and earlier you must enter the formula by pressing CTRL + SHIFT + ENTER. After doing so, you’ll notice curly array brackets appear around the formula.

To show how this formula works, let’s break it down into steps.

This is our final formula (shown without the automatically added array formula brackets):

First, the cell range values are added to the formula as arrays:

Next the Store Name =”A” condition produces an array of TRUE/FALSE values:

Then the IF Function changes all TRUE values into the relevant Order Size:

The MAX Function identifies the largest number in the array, whilst ignoring any FALSE values, to show the largest Order Size for the Store Name = “A”:

## Max If – Multiple Criteria

We can also identify the largest value based on multiple criteria by using Boolean logic.

This example will show the largest Order Size for each Store Name, but for Order Dates before 4/30/2021 by using the MAX, IF and DATE Functions: Notice here we multiply two sets of TRUE/FALSE criteria together:

If both criteria are TRUE then the total condition will calculate as TRUE, but if one (or more) criteria is FALSE it will calculate as FALSE.

Using this methodology, it is possible to add many different criteria to this formula.

## Max If – Multiple Criteria with Cell References

Usually, it is not good practice to hard-code values into formulas. Instead, it’s more flexible to use separate cells to define the criteria.

To match the Store Name to the value shown in column F, we can update the formula to be: ## Locking Cell References

To make our formulas easier to read, we’ve shown the formulas without locked cell references:

But these formulas will not work properly when copy and pasted elsewhere in your file. Instead, you should use locked cell references like this: 