Shade Alternate Rows in Excel

How to Shade Alternate Rows in Excel?

We can shade every alternate row in excel by using the conditional formatting technique, and we can do this by following multiple methods.

You can download this Shade Alternate Rows Excel Template here – Shade Alternate Rows Excel Template

Below is the data I am going to use. You can download the workbook to practice along with me.

Shade Alternate Rows Method 1

Method #1 – Without Using Helper Column

The first method we are going to use is conditional formatting without using the helper column.

Follow the below steps to shade every alternate row in excel.

  1. Select the entire data (without heading).

  2. Go to Conditional Formatting and choose “New Rule.”

    Shade Alternate Rows Method 1-1

  3. In the next window, choose “Use a formula to determine which cells to format.”

    Shade Alternate Rows Method 1-2

  4. In the conditional formatting formula, the bar enters the below formula.

    Shade Alternate Rows Method 1-3

  5. Now, click on the Format tab to choose the formatting color.

    Shade Alternate Rows Method 1-4

  6. Now, it will open up the format cells window. From this window, choose the tab “FILL” and choose the color as per your wish.

    Shade Alternate Rows Method 1-5

  7. Now click on Ok to see the shades in an alternative row.

    Shade Alternate Rows Method 1-6

If you are wondering how this has been done, then say thanks to the formula we have put in, i.e., =MOD(ROW(),2)=1

MOD is the formula to be used to get the remainder value when we divide one number by the other number. For example, MOD (3, 2) will return 1 as the remainder, i.e., when we divide number 3 by number 2, we will get the remainder value as 1.

Similarly, the ROW() function will return the respective row number, and the same row number will be divided by number 2, and if the remainder is equal to number 1, then that row will be highlighted or shaded by the color we have chosen.

Method #2 – Using Helper Column

By simply inserting the helper column of serial numbers, we can shade alternate rows in excel.

  • For this first insert serial number column like the below one.
Using Helper Column Method 2
  • Now select the data except the helper column.
Using Helper Column Method 2-1
  • Again open conditional formatting and choose the same method, but this time, we need to change only the formula. Insert the below formula.
Using Helper Column Method 2-2
  • Click on OK. We will get an alternative shaded row.
Using Helper Column Method 2-3

If you look at the previous one and this one, it is slightly different. In the previous one from the second row of the data was shaded, but in this one, starting from the first row of the data, itself row has been highlighted.

Method #3 – Using VBA Coding

You can simply use the below VBA codeVBA CodeVBA code refers to a set of instructions written by the user in the Visual Basic Applications programming language on a Visual Basic Editor (VBE) to perform a specific more to shade every alternative row. Use the below code to shade alternate rows in excel.


Sub Shade_Rows()

  Dim Rng As Range
  Set Rng = Selection

Rng.FormatConditions.Add xlExpression, Formula1:="=MOD(ROW(),2)=1"

  With Selection.FormatConditions(1).Interior
    .PatternColorIndex = xlAutomatic
    .ThemeColor = xlThemeColorAccent5
    .TintAndShade = 0.399945066682943
  End With

  Selection.FormatConditions(1).StopIfTrue = False

End Sub

For this, first, you need to select the range of cells that needs to be shaded, then run the macro.

Using VBA Coding Method 3

Things to Remember

  • Not only alternative rows, but you can also shade every 3rd row, 4th row or 5th row, and so on. For that, you need to change the divisor value in the MOD function from 2 to 3.
  • Conditional formatting works on the basis of logical results, TRUE or FALSE.
  • ISODD and ISEVEN functions are useful with the helper column of serial numbers.

Recommended Articles

This has been a guide to Shade Alternate Rows in Excel. Here we discuss the top 3 methods to shade alternate rows in excel along with examples and a downloadable template. You may learn more about excel from the following articles –

  • 35+ Courses
  • 120+ Hours
  • Full Lifetime Access
  • Certificate of Completion