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 Excel in Microsoft 365


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 Excel in Microsoft 365.

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

AutoFormatting a Document

The AutoFormat feature of Word can be configured to make changes to a variety of conditions in your document. Here's how ...

Discover More

Incrementing References by Multiples when Copying Formulas

You can easily set up a formula to perform some calculation on a range of cells. When you copy that formula, the copied ...

Discover More

Jumping to a Line Number

Need to jump to a specific line number in your document? It's easy to do using the Go To command, as described in this tip.

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Modifying Axis Scale Labels

You want your chart to display information as clearly and succinctly as possible. Modifying the labels used to indicate ...

Discover More

Labeling X-Y Scatter Plots

Figuring out how to get the data points in an X-Y scatter plot labeled can be confusing; Excel certainly doesn't make it ...

Discover More

Copying a Chart and Related Shapes to a Word Document

Excel and Word are intended to work together, but sometimes it can seem that getting them to do so isn't that intuitive. ...

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 five more than 8?

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.