Excel formula for Beginners – How to find Max of every nth column in Excel

 

 

(Excel examples for Beginners)

In this end-to-end excel example, you will learn – Excel formula for Beginners – How to find Max of every nth column in Excel.

 

Excel formula for Beginners – How to find Max of every nth column in Excel

Generic formula

{=MAX(IF(MOD(COLUMN(rng)-COLUMN(rng.first)+1,n)=0,rng))}

Summary

To get the max of every nth column, you can use an array formula based on the MAX, MOD, and COLUMN functions. In the example shown, the formula in M5 is:

=MAX(IF(MOD(COLUMN(B5:K5)-COLUMN(B5)+1,L5)=0,B5:K5))

Note: this is an array formula and must be entered with control + shift + enter.

Explanation

This formula uses the MOD and COLUMN functions to filter out values not in nth columns, then runs MAX on the result.

The key is this snippet:

MOD(COLUMN(B5:K5)-COLUMN(B5)+1,L5)=0

Here, the formula uses the COLUMN function to get a set of “relative” column numbers for the range which looks like this:

{1,2,3,4,5,6,7,8,9,10}

This array goes into the MOD function as the number argument:

MOD({1,2,3,4,5,6,7,8,9,10},K5)=0

where L5 is the the value to use for “nth”. The MOD function returns the remainder for each column number divided by N. So, for example, when N = 3, MOD will return an array like this:

{1,2,0,1,2,0,1,2,0,1}

Note that zeros appear for columns 3, 6, 9, etc., corresponding to every 3rd column. This array is compared to zero with the logical expression =0 to force a TRUE when the remainder is zero and a FALSE when not. These values go into the IF function as the logical test. The IF function filters accordingly, so only values in the original range in nth columns make it into the final array. The other values become FALSE.

When n = 3, the final array inside MAX looks like this:

MAX({FALSE,FALSE,11,FALSE,FALSE,8,FALSE,FALSE,19,FALSE})

Finally, the MAX function ignores FALSE values and returns the maximum of remaining values, 19.

Max of every other column

If you want to get the max of every other column, just adapt this formula as needed, understanding the formula automatically assigns 1 to the first column in the range. To get the max of EVEN columns, use:

{=MAX(IF(MOD(COLUMN(A1:Z1)-COLUMN(A1)+1,2)=0,rng))}

To get the max of ODD columns, use:

{=MAX(IF(MOD(COLUMN(A1:Z1)-COLUMN(A1)+1,2)=1,rng))}

 


Excel formula for Beginners – How to find Max of every nth column in Excel

 

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!