Awards
Join OfficeTipsAndMethods

Have some suggestions to share with the world?

Join OfficeTipsAndMethods and share your insight in a Comment. You must be a member to comment and all comments are moderated before being published. Membership is free and we would never share your personal information with anyone.

Become an OTM Member

Log In

YouTube Video Channel
OfficeFix
Article Categories

Posts Tagged ‘Excel Graphing’

Chart Intermittent Dates

Downturn  

Quote of the day

To become aware of the possibility of the search is to be onto something.

-Walker Percy

Natasha wanted to graph photocopier downtimes to show the duration of each downtime in minutes with data points labeled with the date of the down time incident. Her data list included the date of the copier needed service and the number of minutes it remained out of order. This seems simple enough but when she tried to generate a graph for the year, every day of the year appeared in the graph. That wasn’t quite what Natasha was looking for. She wanted to show only dates when there was copier downtime.

Graphing, it seems, assumes that if a series consists of date values then you want a date series showing every date between the first and last dates. Here you see the problem in the graph on the left, and a solution in the graph on the right. In the original data, the first entry is February 12 and the last, December 14. Notice how the graph is display dates from February 12 to December 12.

image

Because of the size of the graph, the labels display only one date for each of the eleven months.

The graph on the right, on the other hand, has data points only for each of the dates in its data series. (The size of the graph may cause alternate data points to be un-labeled, so the graph might need to be widened somewhat so that each data point has a label. You may also have to format the axis.) Because the X-Axis data is self-explanatory, I have removed the legend from both graphs.

The secret, to paraphrase Fried Green Tomatoes, is in the formula. Actually, it is in a function that the formula uses. TEXT() is a very versatile function, well worth adding to your Excel arsenal

In this example, I have used TEXT() to convert the date values in column B to text values that include the name of the weekday on which the date occurs.

The TEXT() function converts numeric values to text . It takes two arguments, a reference to a cell containing a numeric value and a string to indicate how the text should be formatted.

For example, the formula in cell J3 is:

=TEXT(B3, “ddd mmm dd”)

The format string here specifies that the text should begin with the three character abbreviation for the day name followed by a space, the three character abbreviation for the month name, another space, and finally a two digit number for the day.

There are many variations on the format string. Search the Excel help files for Text Functions or point your browser to Office On-line. The help article gives full details of how to specify the format string (the second argument of the function) depending on the numeric value you are trying to convert to text.

The point in this example is that by converting the dates in column B to text, and using the data in column J for the series labels, we can fool Excel into displaying date without having it automatically treating the dates a continuous series from the earliest date to the latest date.

Thanks Natasha for raising the question.