Switch x-axis and series entries

bran

New Member
Joined
Jun 14, 2011
Messages
9
I have Excel produce a chart off data consisting of weeks and of sequences of a process. I need the x-axis to be weeks, the y-axis to be the costs, and the legend (series) will consist of the different sequences, so that there will be a couple lines on the graph. The week numbers are contained in one columns and the sequence data with corresponding costs is in multiple columns next to the week column.

Week ...Seq1 ...Seq 2 ...Seq 3 ...Seq 4 ...Seq 5 ...Seq 6
W1 .......324 ......33 ........32 .......34 .......43 ........2
W2 .........34 ......44 ........55 .......23 .......43 .......53
W3 .........44 ......22 ........55 .......45 ........65 ......25
W5..........32 ......44 ........43 ........2 ........12 .......99

The problem is that when I have more sequences than weeks (such as above), Excel formats the x-axis to be the sequences and the legend will contain the weeks. Otherwise, when there are more weeks than sequences, the graph comes out fine.

How can I tell excel to always have weeks (which are contained in a column) be the x-axis values? I know how to do it for one series but for multiple dynamic series, I am unsure. I'd rather not do a loop either but I will if that is all that works.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
In 2003 when creating the chart, on the Data Range tab of Step 2 of the Chart Wizard (Chart Source Data), choose the Series in Columns option.

In 2007 you have to make the chart incorrectly, then fix it. Select the chart, go to the Chart Tools > Design tab, and click on Switch Row/Column.
 
Upvote 0
Thanks for pointing out where I can switch them. I am using 2010 but having to save as 2003. The code I was looking for was this:

ActiveChart.PlotBy = xlColumns

I ended up writing an extensive loop for checking the amount of x-axis entries and series entries and going from there. Now I can simplify it.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top