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

Hits: 538 # (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.

### 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

#### Free Machine Learning & Data Science Coding Tutorials in Python & R for Beginners. Subscribe @ Western Australian Center for Applied Machine Learning & Data Science.

Introduction to Applied Machine Learning & Data Science for Beginners, Business Analysts, Students, Researchers and Freelancers with Python & R Codes @ Western Australian Center for Applied Machine Learning & Data Science (WACAMLDS) !!!

Latest end-to-end Learn by Coding Projects (Jupyter Notebooks) in Python and R:

Applied Statistics with R for Beginners and Business Professionals

Data Science and Machine Learning Projects in Python: Tabular Data Analytics

Data Science and Machine Learning Projects in R: Tabular Data Analytics

Python Machine Learning & Data Science Recipes: Learn by Coding

R Machine Learning & Data Science Recipes: Learn by Coding

There are 2000+ End-to-End Python & R Notebooks are available to build Professional Portfolio as a Data Scientist and/or Machine Learning Specialist. All Notebooks are only \$19.95. We would like to request you to have a look at the website for FREE the end-to-end notebooks, and then decide whether you would like to purchase or not.

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!