LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
Eric D
 
Posts: n/a
Default Sorting values in a bar chart

I am creating an Excel template that will be used to display numerical survey
results for groups of people. The template has several worksheets. Worksheet1
contains a table of names and survey results. The table has eight columns of
numerical data but for simplicity sake well assume the table has just one
result for each person:
A B
1 Name Result
2 Ann 12
3 Bob 9
4 Joe 22
5 Max 17
6 Sam 33
7 Sue 29

Worksheet2 displays a vertical bar chart. The labels along the X axis of the
chart consist of the names in Column A of Worksheet1; the range of the Y axis
is from 9 to 36; and each person's Result from Column B is displayed as a bar
above his or her name. Simple enough. However, I want to sequence the data in
the chart left-to-right by result, so the name with the lowest result appears
in the left-most position in the chart and the name with the highest result
appears in the right-most position in the chart. (This is complicated by the
fact that we want to do this eight times, once for each of the eight columns
of survey results, but we wont deal with that here.)

One way to do this is to create a table in Worksheet3 by using references to
the table in Worksheet1, sort the data in the table in Worksheet3 by Result,
and generate the bar chart from the table in Worksheet3.

However -- and this is the problem -- we want to use this template to create
spreadsheets for multiple groups that will have different numbers of members.
For example, one group will have 8 members, another will have 12, and a third
will have 6. If we don't need to sort the values in the chart in Worksheet2
by result, we can generate the bar chart from the table in Worksheet1; then
we can insert or delete rows of names and results in the middle of the table
in Worksheet1 and the bar chart in Worksheet2 will automatically adjust to
reflect the larger or smaller number of members. We have been doing this for
a few years and it works flawlessly. However, if we use Worksheet3 to sort
the data, the references in Worksheet3 do not change to reflect the inserted
or deleted rows in Worksheet1: if rows are added to the table in Worksheet1,
they are not added to the chart; if rows are deleted, reference errors are
generated.

I am hoping to find some way to identify the range of values in Worksheet1,
such as a named range that specifies the beginning and ending rows in the
range; replicate the values in the range in an array; sort the array by
Result; and use the array to generate the bar chart. Presumably, if rows are
added or deleted in the middle of the range, the array would be adjusted
automatically and hence the chart would correctly display the names of all
the group members sorted by Result. I havent found the Excel functions to do
this. Conceptually, the logic would be something like this:

1. Create array €œSortedbyResults from Worksheet1!A2:B7
2. Sort €œSortedbyResults by Column B
3. Generate bar chart from €œSortedbyResults

For this logic to work, the array would have to be defined by anchoring it
in the top left and lower right corners of the table in Worksheet 1. If rows
were added or deleted from the table, the lower right anchor would
automatically move accordingly.

I will be grateful for any pointers I can get. Please be as specific as
possible, because I have never used arrays in Excel before.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Zero values in a log chart Joelle_Smith Charts and Charting in Excel 2 May 8th 23 03:42 AM
Lines on chart don't correlate to values being charted BW Charts and Charting in Excel 1 April 13th 06 07:53 PM
Urgent Chart Assistance Brent E Charts and Charting in Excel 1 May 10th 05 09:09 AM
I want to ignore invalid values in scatter chart Phil Rowe Charts and Charting in Excel 2 May 6th 05 01:12 PM
how do you prevent data from changing values when sorting linked . Cassie Excel Discussion (Misc queries) 0 March 4th 05 10:45 AM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"