WallStreetMojo

WallStreetMojo

WallStreetMojo

MENUMENU
  • Free Tutorials
  • Certification Courses
  • Excel VBA All in One Bundle
  • Login
Home » Excel, VBA & Power BI » Excel Tutorials » Shade Alternate Rows in Excel

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.

  • Step 1: Select the entire data (without heading).
  • Step 2: Go to Conditional Formatting and choose “New Rule.”

Shade Alternate Rows Method 1-1

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

Shade Alternate Rows Method 1-2

  • Step 4: In the conditional formatting formula, the bar enters the below formula.

Shade Alternate Rows Method 1-3

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

Shade Alternate Rows Method 1-4

  • Step 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

  • Step 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

Popular Course in this category
Sale
All in One Excel VBA Bundle (35 Courses with Projects)
4.9 (1,353 ratings)
35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
View Course

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

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

  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 –

  • New Line in Excel Cell
  • Exporting Excel Files into PDF 
  • Excel Box and Whisker Plot
  • Change Font Color in VBA
0 Shares
Share
Tweet
Share
All in One Excel VBA Bundle (35 Courses with Projects)
  • 35+ Courses
  • 120+ Hours
  • Full Lifetime Access
  • Certificate of Completion
LEARN MORE >>
Primary Sidebar
Footer
COMPANY
About
Reviews
Contact
Privacy
Terms of Service
RESOURCES
Blog
Free Courses
Free Tutorials
Investment Banking Tutorials
Financial Modeling Tutorials
Excel Tutorials
Accounting Tutorials
Financial Statement Analysis
COURSES
All Courses
Financial Analyst All in One Course
Investment Banking Course
Financial Modeling Course
Private Equity Course
Venture Capital Course
Excel All in One Course

Copyright © 2021. CFA Institute Does Not Endorse, Promote, Or Warrant The Accuracy Or Quality Of WallStreetMojo. CFA® And Chartered Financial Analyst® Are Registered Trademarks Owned By CFA Institute.
Return to top

WallStreetMojo

Free Excel Course

Excel functions, Formula, Charts, Formatting creating excel dashboard & others

* Please provide your correct email id. Login details for this Free course will be emailed to you

Book Your One Instructor : One Learner Free Class
Let’s Get Started
Please select the batch
Saturday - Sunday 9 am IST to 5 pm IST
Saturday - Sunday 9 am IST to 5 pm IST

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

WallStreetMojo

Free Excel Course

Excel functions, Formula, Charts, Formatting creating excel dashboard & others

* Please provide your correct email id. Login details for this Free course will be emailed to you

Login

Forgot Password?

WallStreetMojo

Download Shade Alternate Rows Excel Template

New Year Offer - All in One Excel VBA Bundle (35 Courses with Projects) View More