Excel formula for Beginners – How to find Maximum value with if condition

Hits: 37

 

 

 

(Excel examples for Beginners)

In this end-to-end excel example, you will learn – Excel formula for Beginners – How to find Max value with if condition.

 

Excel formula for Beginners – How to find Max value with if condition

Generic formula

{=MAX(IF(range=criteria,values))}

Summary

To get a maximum value based on criteria, you can use the MAX function together with the IF function in an array formula. In the example shown, the formula in cell G6 is:

{=MAX(IF(names=F6,times))}

Where names is the named range B6:B17, and times is the named range D6:D17.

Notes: this is an array formula and must be entered with Control + Shift + Enter. Later versions of Excel have a MAXIFS function, see note below.

Explanation

The IF function is evaluated first. The logical test is an expression that tests all names:

IF(names=F6 // logical test

The result is an array of TRUE / FALSE values like this:

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

TRUE values correspond to rows where the name is “Hannah”. For all other names, the value is FALSE. The “value if true” for IF is the named range times, which contains the full set of times. No “value if false” is provided:

IF(names=F6,times)

The final result from IF is an array like this:

{0.000868055555555556;FALSE;FALSE;0.000902777777777778;FALSE;FALSE;0.000914351851851852;FALSE;FALSE;0.000833333333333333;FALSE;FALSE}

 

Note: Excel times are fractional values, which explains the long decimals.

The IF function acts like a filter. Only time values associated with TRUE make it through the filter, other values are replaced with FALSE.

The IF function delivers this array directly to the MAX function, which automatically ignores FALSE values and returns the max time in the array.

With MAXIFS

The MAXIFS function, available in Excel O365 and Excel 2019, is designed to return a maximum value based on one or more criteria without the need for an array formula. With MAXIFS, the formula in G6 is:

=MAXIFS(times,names,F6)

Excel formula for Beginners – How to find Max value

 

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!