Unwanted Weekend Dates in Chart

Written by Allen Wyatt (last updated March 7, 2020)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and 2021


3

Scott has a set of data by date that is used for a graph. The data is entered by date which only reflects weekdays. (The data contains no entries for weekends.) When Scott graphs the data using the dates as the horizontal axis, Excel inserts the weekend dates with no data points. These dates are not in the original data and he cannot seem to get rid of them so that only the data in the table is shown in the chart.

Believe it or not, this behavior is by design. When you convert your data into a chart, Excel tries to make sense of the data it is charting. If it determines that the data in a particular column or row represents dates, it looks at the earliest date in the range and the latest date in the range and then uses that as the range for the axis. That means that it includes data points in the range that may not really exist in the original data—such as the weekends that Scott mentions.

The solution to this is to overcome the automatic parsing done by Excel as it converts the data in your worksheet into a chart. There are a few ways you can do this. First of all, you can convert your original dates into text values. (Excel doesn't recognize text values as dates, and therefore doesn't do the whole earliest-to-latest range thing.) You could do this by actually converting the date column or row into text or by adding a helper column or row that contains the dates as text representations. If you decide to go the helper route, you could use a formula such as the following:

=TEXT(A1,"m/d/yy")

You could, of course, change the formatting pattern for the date to anything you want, as described in other ExcelTips. You would then use the helper column or row as your axis data in the chart. Excel recognizes it as text and includes only the datapoints in the worksheet—no more phantom weekends!

Interestingly enough, you can also fool Excel in its parsing by simply converting a single cell in the date column into a text value. It appears that if the entire row or column doesn't contain dates, Excel no longer applies the date-range parsing when putting together the chart.

If you don't want to modify your original data, you can simply tell Excel to ignore the date parsing. Follow these steps if you are using Excel 2007 or Excel 2010:

  1. Create your chart as you normally would. You should note that the chart includes the undesired phantom dates (weekends).
  2. Right-click the axis that contains the dates. Excel displays a Context menu.
  3. Choose Format Axis from the Context menu. Excel displays the Format Axis dialog box.
  4. At the left side of the dialog box, choose Axis Options. (See Figure 1.)
  5. Figure 1. The Axis Options of the Format Axis dialog box.

  6. In the Axis Type section of the options, choose Text Axis.
  7. Click OK to close the dialog box.

If you are using Excel 2013 or a later version, then the steps are a bit different:

  1. Create your chart as you normally would. You should note that the chart includes the undesired phantom dates (weekends).
  2. Right-click the axis that contains the dates. Excel displays a Context menu.
  3. Choose Format Axis from the Context menu. Excel displays the Format Axis task pane at the right of your work area.
  4. The Axis Options settings should automatically be displayed, but if not click Axis Options and then the Axis Options icon. (See Figure 2.)
  5. Figure 2. The Axis Options on the Format Axis task pane.

  6. In the Axis Type section of the options, choose Text Axis.
  7. Close the task pane, as desired.

At this point, Excel should redraw your chart and treat your dates as text values, even though they really are dates. This means that you won't get any phantom dates in the date range displayed in the chart. In addition, the dates on the axis should be displayed exactly as they appear in the worksheet data. Thus, if you want to change the way the dates are displayed in the chart, you'll need to reformat your source data for the desired appearance.

You should note that your ability to modify the Axis Type setting depends on the type of chart you are creating. If the chart doesn't have an axis (such as a pie chart) or the chart is primarily for plotting numbers (such as with an XY chart), then you may not be able to tell Excel to treat the axis as text. Why? Because doing so makes no sense in the case of those types of charts.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13271) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Intelligent Title Case

A common editorial need is to change the capitalization used on different words in a selection of text. Word provides a ...

Discover More

Sheets for Months

One common type of workbook used in offices is one that contains a single worksheet for each month of the year. If you ...

Discover More

Changing Coordinate Colors

Tired of the default colors that Excel uses to display the row and column coordinates? You can modify the colors, but ...

Discover More

Program Successfully in Excel! This guide will provide you with all the information you need to automate any task in Excel and save time and effort. Learn how to extend Excel's functionality with VBA to create solutions not possible with the standard features. Includes latest information for Excel 2024 and Microsoft 365. Check out Mastering Excel VBA Programming today!

More ExcelTips (ribbon)

Adjusting Your View of 3-D Graphs

Do you use Excel's charting capabilities to display three-dimensional views of your data? The program provides a way that ...

Discover More

Make that Chart Quickly!

Need to generate a chart in the fastest possible way? Just use this shortcut key and you'll have one faster than you can ...

Discover More

Exporting Black and White Charts

Excel's charts are normally created in color, but you can print them in black and white. You may be looking for a way to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is eight more than 9?

2022-04-19 15:30:24

Pete

Hi Allen. Thanks for your tips. Your face has become familiar to me over the years thanks to google search and your answers are always clear and to the point.


2020-12-18 21:05:21

Allen

It is still there, Michael.

-Allen


2020-12-18 16:38:47

Michael Angelo MUSTILLO

In Excel 365 Axis Type doesn't appear any more, so that option seems to be dead!


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.