Excel formula for Beginners – How to find Maximum if multiple criteria

 

 

(Excel examples for Beginners)

In this end-to-end excel example, you will learn – Excel formula for Beginners – How to find Maximum if multiple criteria.

 

Excel formula for Beginners – How to find Maximum if multiple criteria

Generic formula

{=MAX(IF(rng1=criteria1,IF(rng2=criteria2,values)))}

Summary

To get the maximum value in a data set based on more than one criteria, you can use an array formula based on the MAX and IF functions. In the example shown, the formula in I6 is:

{=MAX(IF(color=G6,IF(item=H6,price)))}

With a color of “red” and item of “hat” the result is $11.00

Note: This is an array formula and must be entered using Ctrl + Shift + entered

Explanation

This example uses the following named ranges: “color” = B6:B14, “item” = C6:C14, and “price” = E6:E14. The goal is to find the maximum price for a given color and item.

This formula uses two nested IF functions, wrapped inside MAX to return the maximum price with two criteria. Starting with a logical test of the first IF statement, color = G6, the values in the named range “color” (B6:B14) are checked against the value in cell G6, “red”. The result is an array like this:

{TRUE;TRUE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE}

In the logical test for the second IF statement, item = H6, the values in the named range item (C6:C14) are checked against the value in cell H6, “hat”. The result is an array like this:

{TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;FALSE;FALSE;FALSE}

The “value if true” for the 2nd IF statement is the named range “prices” (E6:E14), which is an array like this:

{11;8;9;12;9;10;9;8;7}

A price is returned for each item in this range only when the result of the first two arrays above is TRUE for items in corresponding positions. In the example shown, the final array inside of MAX looks like this:

{11;8;9;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE}

Note the only prices that “survive” are those in a position where the color is “red” and item is “hat”.

The MAX function then returns the highest price, automatically ignoring FALSE values.

Alternative syntax using boolean logic

You can also use the following array formula, which uses only one IF function together with boolean logic:

{=MAX(IF((color=G6)*(item=H6),price))}

The advantage of this syntax is that it is easier to add additional criteria without adding additional nested IF functions. If you need OR logic, use addition instead of multiplication between conditions.

With MAXIFS

The MAXIFS function, introduced in Excel 2016, is designed to calculate maximums based on one or more criteria without the need for an array formula. With MAXIFS, the formula in I6 is:

=MAXIFS(price,color,G6,item,H6)

Note: MAXIFS will automatically ignore empty cells that meet criteria. In other words, MAXIFS will not treat empty cells that meet criteria as zero. On the other hand, MAXIFS will return zero (0) if no cells match criteria.


Excel formula for Beginners – How to find Maximum if multiple criteria

 

Personal Career & Learning Guide for Data Analyst, Data Engineer and Data Scientist

Applied Machine Learning & Data Science Projects and Coding Recipes for Beginners

A list of FREE programming examples together with eTutorials & eBooks @ SETScholars

95% Discount on “Projects & Recipes, tutorials, ebooks”

Projects and Coding Recipes, eTutorials and eBooks: The best All-in-One resources for Data Analyst, Data Scientist, Machine Learning Engineer and Software Developer

Topics included: Classification, Clustering, Regression, Forecasting, Algorithms, Data Structures, Data Analytics & Data Science, Deep Learning, Machine Learning, Programming Languages and Software Tools & Packages.
(Discount is valid for limited time only)


Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.

Learn by Coding: v-Tutorials on Applied Machine Learning and Data Science for Beginners

Please do not waste your valuable time by watching videos, rather use end-to-end (Python and R) recipes from Professional Data Scientists to practice coding, and land the most demandable jobs in the fields of Predictive analytics & AI (Machine Learning and Data Science).

The objective is to guide the developers & analysts to “Learn how to Code” for Applied AI using end-to-end coding solutions, and unlock the world of opportunities!