fbpx
Search
Close this search box.

Customize Zebra lines Quickly using Table Styles [tip]

Share

Facebook
Twitter
LinkedIn

Zebra lines, highlighting applied to alternative rows is a very good way to make tables readable & pretty.

We can use either conditional formatting or table formats to quickly add zebra lines to our data.

But what if you want a little more?

What if you want to highlight, lets say 3 rows in one color and 3 in another and repeat this …

Custom Zebra lines using Excel table formats - how to?

Of course, we can use conditional formatting and come-up with some clever mix of ROW & MOD. But why waste so much of creative sauce on something as trivial as zebra line? So here is a quick alternative.

Use Table styles and tell excel how you want to highlight the lines.

Steps to create custom zebra lines

  1. First convert your data to table, if you have not already done it.
  2. Now, go to Table Design ribbon and right click on the table style you want and choose duplicateCreate a duplicate table style by right clicking on the style you want
  3. Excel creates a duplicate table style and opens a box to edit it.
  4. Give it a friendly name like myTableStyle1 or zebra-v1
  5. Select “First Row Stripe” and set stripe size to 2 or 3 as you want.
  6. Repeat the step for “Second Row Stripe” as well.Customizing table style - set stripe sizes
  7. Click OK & save your style.
  8. And now, apply this style to your table by selecting it from Table styles gallery.
  9. Your custom zebra is ready to bray and jump around.

Bonus tip #1: You can have 2 different stripe sizes too

For example you can have 5 rows for first stripe and  2 for second stripe, thus highlighting weekends in a different color.

Bonus tip #2: You can apply the same to columns too

You can apply the same concept to column stripes (banded columns) and set their sizes using table styles.

Bonus tip #3: Turn on / off zebra lines with a click

If you ever feel tired looking at all the stripes, you can quickly turn them off /on from Design Ribbon > Banded Rows

Turn on - off zebra lines / banded rows using table settings in Excel

 

Homework: Change color when value changes

When you have few values with some duplicates, it makes sense to apply a band color whenever there is a change in value. How to set up zebra lines then? See here for your homework.

[Related: Zebras & Checker boards using Excel]

Do you use custom table styles?

Custom table styles are an easy way to tell Excel how we want our data to look. I use them often when designing a report or spreadsheet model.

What about you? Do you use custom styles? Have you tried the stripe size feature? What is your experience like? Please share using comments.

 

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

14 Responses to “Customize Zebra lines Quickly using Table Styles [tip]”

  1. Luke M says:

    Thanks for the tip. Having just switched over to 2007 from 2003 within the past year, I know there's lots of cool features that I'm simply not aware of, and tables and all their functions/features are certainly one of them. Thanks for all the great articles you've done talking about tables.

  2. Kevin says:

    for some reason can't get this to work for me. After pressing okay and then. It just stays as it was.Any advice? tks

  3. Carolanne says:

    This is so spooky - I had this issue come up yesterday, but I need to highlight every alternate 200 rows - for batch emailing - any way to do this?

    • Hui... says:

      @Carolanne

      I would use a Conditional Format formula of: =ISEVEN(INT(ROW()/200)+1)

       

    • Adrian says:

      use some VBA e.g. routine FormatResults

      Sub AlternateRowColors(rTmp As Range)
          Const iEven% = 1    'colour rows (1 even, 0 odd)
          Const iStartRw% = 0
          Const iGrpRw% = 200 'block rows
          rTmp.Interior.ColorIndex = xlNone        ''color to preference or remove
          For Each rCell In rTmp.Rows     ''change range accordingly
              If (rCell.Row - iStartRw) Mod iGrpRw * 2 < iGrpRw Then rCell.Interior.ColorIndex = 15              ''color to preference
          Next rCell
      End Sub

      Sub FormatResults()
          Dim rTmp As Range
          Set rTmp = Sheet1.[A19].CurrentRegion
          AlternateRowColors rTmp
      End Sub

  4. Suresh says:

    Thanks for the tip. Is it possible to save custom table design so that they can be applied to other tables?

  5. Doug says:

    This is a great tip! I haven't tried customizing the table feature styles and will give it a try.  There is still value in using the ROW and MOD combination if you want to dynamically alternate which other rows you want to shade (i.e. every 3rd or 4rth row).  This video shows how http://youtu.be/FFnCnClSv1U.

  6. Brian says:

    I have created an Excel 2010 pivot table using a flattened table from the powerpivot menu. For some reason, banded rows do not get displayed. I have tried the custom zebra lines and even after the custom settings are applied, the rows remain unformatted.

    Is there another setting that overrides the banded rows?

    Thanks.

Leave a Reply