PTS Blog

Custom Solutions | Commercial Utilities | Training | Charts and Tutorials | PTS Blog

 

Main menu:

 
Peltier Tech
Chart Utilities

PTS Waterfall Chart Utility
PTS Cluster-Stack Column Chart Utility
PTS Box and Whisker Chart Utility
PTS Marimekko Chart Utility

Subscribe

Site search

Subscribe

Site search


Recent Posts

Recently Commented

Popular Posts

Archive


 

Categories


 

Buy me a coffee

If this topic or the whole blog has been helpful, support further development by treating me to a cup of coffee.


Privacy Policy

Creative Commons License
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

Split Data Range into Multiple Chart Series without VBA

by Jon Peltier
Peltier Technical Services, Inc., Copyright © 2009.
Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

In VBA to Split Data Range into Multiple Chart Series I shared a VBA procedure that split a range into separate series in a chart. In fact, this is fairly easy to do using conditional chart formatting techniques I describe on my web site (see Simple Conditional Charts). The way these techniques work is to use formulas in separate columns to capture values from the main data column when certain conditions are met.

The data used in the other post is shown below, with the conditional columns added.


A B C D E F G
1 City X Y Atlanta Boston Chicago Detroit
2 Atlanta 4 15 15 #N/A #N/A #N/A
3 Atlanta 5 18 18 #N/A #N/A #N/A
4 Boston 6 16 #N/A 16 #N/A #N/A
5 Boston 6 16 #N/A 16 #N/A #N/A
6 Boston 7 12 #N/A 12 #N/A #N/A
7 Boston 11 11 #N/A 11 #N/A #N/A
8 Chicago 10 13 #N/A #N/A 13 #N/A
9 Chicago 13 10 #N/A #N/A 10 #N/A
10 Chicago 15 8 #N/A #N/A 8 #N/A
11 Detroit 10 9 #N/A #N/A #N/A 9
12 Detroit 15 5 #N/A #N/A #N/A 5
13 Detroit 13 3 #N/A #N/A #N/A 3
14 Detroit 14 6 #N/A #N/A #N/A 6


The unique items from column A are entered into row 1 of columns D through G. The following formula is entered into cell D2 and filled into the entire range D2:G14:


=IF($A2=D$1,$C2,NA())

The formula compares the label in column A with the header in row 1: if they match, the formula returns the value in column C otherwise it returns #N/A, which is not charted in a line or XY chart (for a bar or column chart, use the empty string “” instead of NA()).
Select the X Values (B1:B14), then hold CTRL while you select the conditional Y values (D1:D14), then create a chart. After formatting, the result is identical to the chart processed by VBA approach:

Possibly Related Posts:

Bookmark and share this entry:
  • Digg
  • del.icio.us
  • Facebook
  • Technorati
  • TwitThis
  • StumbleUpon
  • Google Bookmarks
  • Reddit
  • MySpace
  • Slashdot
  • LinkedIn
  • Yahoo! Buzz

Learn how to create Excel dashboards.

Comments


Comment from Frank R.
Time: Monday, August 18, 2008, 9:38 am

This is exactly what I was looking for. Thanks.


Comment from Richard
Time: Saturday, November 1, 2008, 2:53 pm

This works well as long as you are only plotting points.

If you want to interrupt a line between the points it seems that you now have to write a macro to copy out the data, leaving blank cells where gaps are needed.

What a nuisance! It used to be so easy! Or am I missing a trick, here?


Comment from Jon Peltier
Time: Monday, November 3, 2008, 7:49 am

Richard -

This behavior is unchanged since Excel 97 (or earlier).

Write a comment

I welcome comments from my readers. If you have an opinion on this post, if you have a question or if there is anything to add, I want to hear from you. Whether you agree or disagree, please join the discussion.

If you want to include an image in your comment, post it on your own site or on one of the many free image sharing sites, and include a link in your comment. I'll download your image and insert the necessary html to display the image inline.

Read the PTS Blog Comment Policy.





Subscribe without commenting

PTS Waterfall Chart Utility PTS Cluster-Stack Column Chart Utility PTS Box and Whisker Chart Utility PTS Marimekko Chart Utility

Create Excel dashboards quickly with Plug-N-Play reports.