Highlight Every Alternate Set of N Columns In Google Sheets

In this tutorial, you will get a conditional format rule to dynamically highlight every alternate set of n columns in Google Sheets.

For example, if n = 2, with the said rules, we can highlight columns A and B with light blue color, C and D with light red color, and repeat the same.

You can control the set of n columns within a cell by referring to that cell in the formula.

Highlight Every Alternate Set of N Columns - Example

Similar to highlighting every alternate set of n columns, I have a formula for the rows, which you can find here – Highlight a Set of Alternate Rows in Google Sheets.

Formula to Highlight Every Alternate Set of N Columns

We will apply the conditional format rule for an entire worksheet, i.e., in the range A1:Z1000.

Later we can adjust the formula for our required range.

I’ve used the following formula in the above example to fill the background with a light blue color.

Rule # 1:

=mod(column(A$1)-column($A$1),$A$1*2)<$A$1

And the below formula for the light red.

Rule # 2: (Optional)

=mod(column(A$1)-column($A$1),$A$1*2)>=$A$1

I’ll explain how to insert the above two rules to highlight every alternate set of n columns in Google Sheets.

Before that, please note that the n in the above formulas is the cell reference $A$1 which is highlighted in green.

That means you can control the number of columns in each set from cell A1.

A1 value and how it affects the highlighting:

A1 ValueSet of Columns (Behavior)
1Every other column
2Every Alternate Set of 2 Columns
3Every Alternate Set of 3 Columns
…and so on.

If you don’t want dynamic behavior, then replace $A$1 with the corresponding number.

If you are a newbie, follow the below steps to set up the above two conditional format rules in Google Sheets.

Steps to Apply the Rules to Highlight Alternate Set of N Columns

First, open the file and go to the corresponding sheet tab. Then follow the steps below.

  1. Go to the menu Format > Conditional formatting.
  2. Apply to range – A1:Z1000.
  3. Format Rules > Format cells if > Custom formula is – enter above Rule # 1 formula.
  4. Format Rules > Format style – select fill color (light blue).
  5. Click Add another rule and edit steps 3 and 4 above. In step 3, insert the above Rule # 2 formula, and in step 4, choose the light red color.
  6. Click Done.
  7. Enter 3 in cell A1 and see what happens.
Steps to Apply the Rules to Highlight Alternate Set of N Columns

We have learned how to highlight every alternate set of N columns in Google Sheets.

Fill Color Starting From a Different Column (Other than A)

I know you may not use the above background coloring in your entire sheet.

You may want to leave a few columns in the front.

For example, keep columns A to C out of the covered area of the above highlighting rules.

So it’s crucial to know how to modify my formula to apply the fill color starting from a different column other than A.

You can use the below two formulas to highlight every alternate set of 5 columns from column D.

Light Blue:

=mod(column(D$1)-column($D$1),$A$1*2)<$A$1

Light Red:

=mod(column(D$1)-column($D$1),$A$1*2)>=$A$1

The Apply to the range for both the rules must start from column D, i.e., D1:Z1000.

Finally, enter 5 in cell A1.

That’s all. Thanks for the stay. Enjoy!

Resources

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Count Consecutive Duplicates in Excel (Dynamic Array Formula)

Counting consecutive duplicates in Excel is useful for analyzing patterns, detecting repetitive sequences, and...

How to Break RANK Ties Alphabetically in Google Sheets

The RANK function in Google Sheets is commonly used to assign rankings to numerical...

Google Sheets: Highlight an Entire Column If Any Cell Has an Error

Google Sheets allows you to highlight an entire column if any cell has an...

Filter Top N per Category in Excel (Using FILTER & COUNTIFS)

You can use a combination of FILTER and COUNTIFS to filter the top N...

More like this

How to Break RANK Ties Alphabetically in Google Sheets

The RANK function in Google Sheets is commonly used to assign rankings to numerical...

Google Sheets: Highlight an Entire Column If Any Cell Has an Error

Google Sheets allows you to highlight an entire column if any cell has an...

Google Sheets: Extract Top N per Group from Query Aggregation

When working with grouped and aggregated data in Google Sheets, you might need to...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.