|

Excel: Using an Alternate Calendar

By Bill Jelen
December 1, 2016
3 comments
Excel_web_image

Microsoft Excel has a lot of settings that assume you have a fiscal year that ends on December 31 with 12 months that correspond to calendar months. But what if your company uses an alternate calendar, such as a fiscal year ending in March, a 13-month calendar, or a 4-5-4 calendar popular in companies that measure retail sales? The new Data Model in Excel 2013 can help.

 

CREATE A CALENDAR TABLE

 

Say that you have data for 2016 and 2017 based on the National Retail Federation 4-5-4 Calendar (http://bit.ly/2eCFaae). You need to create a calendar table that has one row for each date in your data set. Add a new worksheet with each day from January 1, 2016, through February 3, 2018, listed in column A. Add columns for year, season, quarter, month, week, day, and weekday. Use row 1 for the header cell for each column. Make sure there are no other heading cells other than those in row 1.

 

Select one cell in this data set and press Ctrl+T to define it as a table. Confirm that your data has a header row. Excel will apply a default formatting to the table, and a Table Tools Design tab will appear in the ribbon. Look on this tab in the ribbon, and you can see that Excel assigned a name such as “Table1” to the table. Click in the Table Name box and assign a name such as “Calendar.”

 

 

Any time that you need to create a pivot table and report using the alternate calendar, you will copy this small worksheet into the workbook containing your sales data.

 

JOIN MULTIPLE TABLES

 

You can use Data Model pivot tables to join multiple tables. Say that you have data from your point of sale (POS) system. It includes fields such as Date, Time, Transaction ID, Partner #, Merchandise Amount, Sales Tax, and Total. Even though you could create a pivot table from this data, you need to format the data as a table if you’re going to join it to the Calendar table. Select one cell in the data set and press Ctrl+T. Confirm that the table has headers. Excel will suggest a name such as “Table2.” You should rename the table to something meaningful, like “Sales” or “Transactions.”

 

Now go to your transactional data set. Select Insert, Pivot Table. In the Create PivotTable dialog, choose the box for Add This Data to the Data Model.

 

 

When the Pivot Table Field List appears, there will be a new choice at the top letting you select between Active or All. Change the setting to All, and the Calendar table will appear in the field list as well. Click the triangle icon next to each table to expand the list of fields for each table.

 

 

Build a pivot table using fields from the Calendar table in the rows or columns. Place the Revenue field from the transaction table in the Values area.

 

A yellow box will appear in the Pivot Table Field List showing that Relationships May Be Needed. In Excel 2013, the only choice is Create. In Excel 2016, you can choose to Auto-Detect the relationship. When you choose Create, you have to specify that the Date field from the Sales table is related to the Date field from the Calendar table.

 

 

Once you’ve established the relationship, you can build any pivot table using the year, season, quarter, month, week, or weekday fields from the Calendar table.

 

 

 

FILL 4-5-4 MONTH ENDING DATES

 

While the fill handle is great at filling month names such as January, February, and March, it requires special handling for filling month-ending dates. For a regular calendar, type 1/31/2017 in a cell. Right-click the fill handle and drag. When you release the mouse button, a fly-out menu appears where you can choose Fill Months to make the month-ending dates appear. But there’s no equivalent tool for filling month-ending dates of a 4-5-4 calendar.

 

Follow these steps:

 

  1. Type a heading such as MonthEnd and add the month-ending dates to the column.
  2. In an adjacent column, use =TEXT(C2,“M/D/YYYY”) to convert the dates to text.

 

 

  1. Select your list of text dates and the MonthEnd heading.
  2. Go to File, Options, Advanced. Scroll most of the way through the list and choose Edit Custom Lists. Click Import to import your list. Click OK.
  3. In the future, to fill the month-ending dates, type MonthEnd in any cell and drag the fill handle. The text dates will appear. While those dates are selected, type Alt+DEF <enter> to convert the text dates to real dates.

Save

Save

Bill Jelen is the author of MrExcel XL: 40 Greatest Excel Tips. Send questions for future articles to IMA@MrExcel.com.
3 + Show Comments

3 comments
    kHANH pHAM December 2, 2016 AT 1:14 pm

    GREAT TIP

    Muhammad Fathy December 2, 2016 AT 4:35 pm

    Amazing work!

    Michele December 13, 2016 AT 8:36 am

    I do not see Add this data to the data model under create pivot table. Is this an add in?

You may also like