# Shade Alternate Rows in Excel Article byJeevan A Y ## 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.

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

#### Method #1 – Without Using Helper Column

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

1. Select the entire data (without heading).

2. Go to Conditional Formatting and choose “New Rule.” 3. In the next window, choose “Use a formula to determine which cells to format.” 4. In the conditional formatting formula, the bar enters the below formula. 5. Now, click on the Format tab to choose the formatting color. 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. 7. Now click on Ok to see the shades in an alternative row. 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.
• Now select the data except the helper column.
• Again open conditional formatting and choose the same method, but this time, we need to change only the formula. Insert the below formula.
• Click on OK. We will get an alternative shaded row.

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 to shade every alternative row. Use the below code to shade alternate rows in excel.

Code:

```Sub Shade_Rows()

Dim Rng As Range
Set Rng = Selection

Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority

With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent5
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.

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