• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course โ€“ Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

Excel Slicers for Rolling Periods

You are here: Home / Excel PivotTables / Excel Slicers for Rolling Periods
Excel Slicer rolling periods
May 6, 2015 by Mynda Treacy

Excel Slicers for rolling periods, for example; the last 12 months, requires a column in your source data that looks up the date and compares it to todayโ€™s date to see if it falls into the current period.

Download the Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.
Please enter a valid email address.

Download the Excel Workbook. Note: This is a .xlsx file please ensure your browser doesn't change the file extension on download.

Watch the Video

Watch right to the end to see the bloopers!

Creating Excel Slicers for Rolling Periods

Below is my data: in column A I have the date for each record and in column C I use an IF function to compare todayโ€™s date (returned from your computerโ€™s clock using the TODAY() function in cell F2), to the date in column A to see if it falls within the last 12 months.

excel slicers for rolling periods raw data

The formula:

=IF(today-[@Date]<365,"Last 12 Mths",">12 Mths")

Note: today is a named range for cell F2 which contains the formula =TODAY(). This formula returns the date from your computerโ€™s clock.

English Translation of the IF formula:

=IF (todayโ€™s date minus [the date in column A] ) is less than 365, then enter the text "Last 12 Mths", otherwise enter the text ">12 Mths"

Now we can build the PivotTable and or Pivot Chart and add a Slicer for the Rolling Period:

excel slicers for rolling periods pivottable and chart

And because Iโ€™ve grouped my data by month I donโ€™t have the day detail so I want to make it absolutely clear which period the chart is displaying by inserting a custom chart title that automatically displays the date range.

Warning: Donโ€™t forget to refresh the PivotTable/Pivot Chart so that it displays the correct โ€˜last 12 monthsโ€™.

If your PivotTable is pulling in the data from another system you could turn on the โ€˜Refresh data when opening the fileโ€™ in the PivotTable Options menu:

pivottable refresh on file open

Excel Slicer rolling periods

More Slicers Posts

Symbols in Excel Slicers

Symbols in Excel Slicers is a fun way to make your reports more interesting. Here are some tricks to getting wingdings and symbols to display in Slicers.
Slicer Controlled Interactive Excel Charts

Slicer Controlled Interactive Excel Charts

Slicer Controlled Interactive Excel Charts can open up a huge range of possibilities and the best part is you can use Slicers to control regular charts too.
slicer selection in formula

Use Excel Slicer Selection in Formulas

How to use Excel Slicer selection in formulas to control charts and tables. Download the workbook and follow along.
Excel Slicer Trick

Excel Slicer Trick

In this Excel Slicer Trick I show you how to use a Slicer to display a drilled down view of your data in a PivotChart. Download the file and follow along.
Excel Slicers for Fiscal Years

Excel Slicers for Fiscal Years

Inseting Excel Slicers for Fiscal Years is easy but requires a bit of DIY date classification.
Single Slicer for Year and Month

Create a Single Excel Slicer for Year and Month

How to create a single Excel Slicer for Year and Month fields. Includes written instructions, video and workbook download.
Excel Slicers

Excel Slicers – Everything You Need to Know

How to insert and use Excel Slicers to create interactive charts and PivotTables. Includes video and step by step written instructions.
Sorting Excel Date Slicers

Sorting Excel Date Slicers

Slicers have some shortcomings when it comes to dates and sort order. This post explains a couple of ways to sort dates correctly in Excel slicers.

More Excel PivotTables Posts

Auto Refresh PivotTables

Auto Refresh PivotTables isnโ€™t on by default, and the process differs depending on if your PivotTables is loaded to the data model or not.

Show Items with no Data in PivotTables

Show Items with no Data in PivotTables allows you to maintain a constant structure to your PivotTable or Pivot Chart axis when filtering.

Force Excel Slicers to Single Select

There's no build in way to force Excel Slicers to single select but we can use these clever warnings to persuade your users.
excel pivottable p&L

Excel PivotTable Profit and Loss

Creating an Excel PivotTable Profit and Loss Statement means you can use Slicers and Conditional Formatting and have the P&L automatically update.

Excel PivotTable Field List Tips

Customize the Excel PivotTable Field List to suit your needs. Find how to turn the PivotTable Field List on and off and other handy tips.

Hide Blanks in Excel PivotTables

Hide blanks in Excel PivotTables caused by empty cells in your source data. Iโ€™m talking about PivotTable cells containing the (blank) placeholder.
Excel Slicer Formatting

Excel Slicer Formatting

Excel Slicer Formatting is essential because theyโ€™re big and chunky. In this tutorial I show you the tricks to make Excel Slicers small.
Excel PivotTable Quick Explore

Excel PivotTable Quick Explore

Drill down into data hierarchies using PivotTables and Pivot Charts with Excel PivotTable Quick Explore. New in Excel 2013 onward.
excel online pivottables

Excel Online PivotTables

Excel Online PivotTables are now available from the Insert tab of the ribbon. There are some limitations that are covered in this post.

Excel PivotTable Error Handling

Excel PivotTable error handling and why you canโ€™t calculate the percentage change when the prior period is zero or blank.


Category: Excel PivotTablesTag: slicers
Previous Post:Single Slicer for Year and MonthCreate a Single Excel Slicer for Year and Month
Next Post:Excel Slicers for Fiscal YearsExcel Slicers for Fiscal Years

Reader Interactions

Comments

  1. Jim Fisher

    September 11, 2021 at 1:05 am

    Exactly what I was looking for to get rolling data! Thanks Mynda!

    Reply
    • Mynda Treacy

      September 11, 2021 at 10:54 am

      Glad it was helpful, Jim!

      Reply
  2. Craig Hamilton

    July 3, 2019 at 7:57 am

    Hi Mynda
    I am new to excel and am trying to get a rolling 12 hours is this possible? My data is collected every 60 seconds from a plc and I would like a chart showing the last 12 hours or from 6am to 6pm and 6pm to 6am would be even better

    Thanks

    Reply
    • Catalin Bombea

      July 3, 2019 at 3:32 pm

      Hi Craig,
      Can you please upload a sample file with your data and a description of what you’re after? Use our forum to upload (create a new topic)

      Reply
      • Craig Hamilton

        July 4, 2019 at 4:25 pm

        Hi Catalin

        I have posted the question in the forum

        Thank you
        Craig

        Reply
  3. owk owk

    April 13, 2019 at 8:43 pm

    Fantastic ! My out most praises for such great and clear media. Thank you very much.

    Reply
    • Mynda Treacy

      April 14, 2019 at 1:37 pm

      ๐Ÿ™‚ you’re welcome!

      Reply
  4. Jennifer

    March 7, 2019 at 3:22 am

    Is it possible to create a slicer for 4-week, 12-week, 26 week and 52 week rolling? I understand from this post how to make 52 week but the 4/12/26 is a bit more challenging.
    The goal is to look at sales trends for different time periods easily with one click instead of selecting 26 week endings at once.

    Reply
    • Mynda Treacy

      March 7, 2019 at 9:46 am

      Maybe a Timeline would suite you better. I mention them briefly at the end of this tutorial: https://www.myonlinetraininghub.com/create-a-single-excel-slicer-for-year-and-month

      Reply
  5. Ryan

    March 16, 2018 at 3:14 am

    My data is usually tracked by Year and Month – I do not track Days. Is there a way to do this with a separate year and month column or does the date have to be formatted year-month-day in the same column?

    Reply
    • Mynda Treacy

      March 16, 2018 at 10:26 am

      Hi Ryan,

      You need a numeric field to check if the date in your data is less than 12 months ago and if you only have year and month then my guess is that’s a text field, not a numeric field. You could change it to a numeric field and use that, but you’d have to change the IF formula to suit, or you could just add a column that represents a proper date dd/mm/yyyy or mm/dd/yyyy.

      If you get stuck please post your question and sample Excel file on our forum.

      Mynda

      Reply
    • Gav

      June 28, 2018 at 10:38 pm

      you can use a nifty function called EDATE

      =IF(RefDate<EDATE(TODAY(),-12),"12 Mths”)

      Where RefDate is the date you want to evaluate from.
      Can be start, middle or end of the month depending on how you want to evaluate your rolling periods i.e. into the past or forecast for the future.

      Although I kinda prefer using -13 months because I like to see current month vs same month in the prior year. ๐Ÿ˜‰

      Reply
  6. Phillip

    September 9, 2017 at 6:26 am

    Excellent tutorial–worked flawlessly. I’ve been using Excel for decades and have never used the Slicer and “structured tables”. Very useful and now I’ll start to use them.

    Reply
    • Mynda Treacy

      September 10, 2017 at 9:03 pm

      Great to hear, Phillip ๐Ÿ™‚

      Reply
  7. Rachel

    August 18, 2017 at 1:51 am

    Hi Mynda, how did you insert a custom chart title that automatically displays the date range?

    Reply
    • Mynda Treacy

      August 18, 2017 at 8:51 am

      Hi Rachel,

      I used a dynamic text label as described here: https://www.myonlinetraininghub.com/excel-dynamic-text-labels

      Mynda

      Reply
      • Rachel

        August 18, 2017 at 10:37 am

        Hi Mynda,

        Thank you for publishing this article and for your prompt reply. Learning how to use slicers to create a rolling 3-week PivotChart / learning how to create dynamic chart titles were both very useful skills to learn. You are a lifesaver!

        Best,
        RF

        Reply
        • Mynda Treacy

          August 18, 2017 at 11:02 am

          Glad you found them useful, Rachel ๐Ÿ™‚

          Reply
  8. MF

    May 7, 2015 at 1:05 pm

    Hi Mynda,

    I ran into a similar situation recently and tried to deploy a similar approach as you presented here. However I gave up and decided to use a not-so-effective approach simply because

    “Warning: donโ€™t forget to refresh the PivotTable/Pivot Chart so that it displays the correct โ€˜last 12 monthsโ€™.”

    Sadly but true, users of my report are not familiar with Excel. I can by no mean assure that they will “refresh” the Pivot Table after they change the variable of date (in my case, last 12 months depends on which dates user selected). Although Macro can do the job easily, the problem is ONLY when the macro is enabled and which requires USER’s co-operation. @_@

    My not-so-effective approach is to create a Slicer of months in YYYYMM, so that user can select whatever periods they wish by simply click-and-drag. You can imagine how many icons could be there in a single slicer. This is not perfect but at least users are aware of the changes they made.

    Cheers,

    Reply
    • Mynda Treacy

      May 7, 2015 at 1:38 pm

      Hi MF,

      On the upside, if you set the refresh to happen on File Open then you shouldn’t have this problem. I guess if the user is also adding the new data then you need them to refresh it.

      If it weren’t for the Users… ๐Ÿ˜‰

      Mynda

      Reply
      • MF

        May 7, 2015 at 5:56 pm

        HI Mynda,
        Thanks for your suggestion… however that does not work in my case as my “rolling month” is based on the selection made by users, not on =TODAY().

        MF

        Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Current ye@r *

Leave this field empty

Sidebar

More results...

Featured Content

  • 10 Common Excel Mistakes to Avoid
  • Top Excel Functions for Data Analysts
  • Secrets to Building Excel Dashboards in Less Than 15 Minutes
  • Pro Excel Formula Writing Tips
  • Hidden Excel Double-Click Shortcuts
  • Top 10 Intermediate Excel Functions
  • 5 Pro Excel Dashboard Design Tips
  • 5 Excel SUM Function Tricks
  • 239 Excel Keyboard Shortcuts

100 Excel Tips and Tricks eBook

Download Free Tips & Tricks

Subscribe to Our Newsletter

Receive weekly tutorials on Excel, Power Query, Power Pivot, Power BI and More.

We respect your email privacy

Guides and Resources

  • Excel Keyboard Shortcuts
  • Excel Functions
  • Excel Formulas
  • Excel Custom Number Formatting
  • ALT Codes
  • Pivot Tables
  • VLOOKUP
  • VBA
  • Excel Userforms
  • Free Downloads

239 Excel Keyboard Shortcuts

Download Free PDF

Free Webinars

Excel Dashboards Webinar

Watch our free webinars and learn to create Interactive Dashboard Reports in Excel or Power BI

Click Here to Watch Now

mynda treacy microsoft mvpHi, I'm Mynda Treacy and I run MOTH with my husband, Phil. Through our blog, webinars, YouTube channel and courses we hope we can help you learn Excel, Power Pivot and DAX, Power Query, Power BI, and Excel Dashboards.

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk – For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.