Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Conditional Formatting Color Scales Examples in Excel
  • Data Series in Excel
  • How to combine 2 or more chart types in a single chart in Excel
  • Filter Data Based on Date in Excel
  • Understanding Anova in Excel

References

  • How to get address of first cell in range in Excel
  • How to reference named range different sheet in Excel
  • Two-way lookup with VLOOKUP in Excel
  • How to use Excel OFFSET function
  • Convert text string to valid reference in Excel using Indirect function

Data Validations

  • Excel Data validation date in next 30 days
  • How To Create Drop-down List in Excel
  • Prevent invalid data entering in specific cells
  • Excel Data validation whole percentage only
  • Excel Data validation allow uppercase only

Max of every nth column in Excel

by

This tutorial shows how to calculate Max of every nth column in Excel using the example below;

Formula

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

Explanation

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.

How this formula works

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

Worked Example:   Excel MAX, MATCH and ADDRESS function illustration

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 (explained in detail here) 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:

Worked Example:   How To Use AGGREGATE function to sum a range with errors in Excel

{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.

Worked Example:   How to get first column number in range in Excel

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))}

Post navigation

Previous Post:

Weighted average in Excel

Next Post:

Win loss points calculation in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • How to return blank in place of #DIV/0! error in Excel
  • Complete List of Excel Logical Functions, References and Examples
  • How to use Excel XOR Function
  • How to use Excel NOT Function
  • AND function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • Get days, months, and years between dates in Excel
  • Convert Unix time stamp to Excel date
  • DATEDIF function: Description, Usage, Syntax, Examples and Explanation
  • Get days, hours, and minutes between dates in Excel
  • How to calculate percent of year complete in Excel

Grouping

  • Group arbitrary text values in Excel
  • If cell contains one of many things in Excel
  • Group numbers with VLOOKUP in Excel
  • Map inputs to arbitrary values in Excel
  • How to randomly assign data to groups in Excel

General

  • Find, Trace and Correct Errors in Excel Formulas using ‘Formula Auditing’
  • How to generate random number weighted probability in Excel
  • Select, Insert, Rename, Move, Delete Worksheets in Excel
  • How to count total number of cells in a rectangular range in Excel
  • How to increase by percentage in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning