Two axis charts

TG2812

Board Regular
Joined
Apr 15, 2015
Messages
192
Hello,

I'm trying to get my head around doing a simple chart at first but it turns out to be a nightmare.

I want to create the chart in the first image i uploaded in Excel. My dataset is attached in the second picture.

Any help would be greatly appreciated!

PS: if you could provide your response using an excel sheet, this would be fantastic. Thank you! :)
 

Attachments

  • Chart I want to create in Excel.jpg
    Chart I want to create in Excel.jpg
    227.2 KB · Views: 12
  • My current chart and dataset.jpg
    My current chart and dataset.jpg
    95.3 KB · Views: 12

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
It's a shame you chopped off the axes in your first picture. Can you repost? Also:

  • What value do the red crosses represent in your data? I can't seem to match them up with anything.
  • Why does your desired output only have 9 bars?
 
Upvote 0
It's a shame you chopped off the axes in your first picture. Can you repost? Also:

  • What value do the red crosses represent in your data? I can't seem to match them up with anything.
  • Why does your desired output only have 9 bars?
Thank you for your reply.
Regarding the first image and the axes:
- We can see the x axis (primary) at the bottom. It represents the MIN and MAX weight (columns B & C) in my dataset. Should start around 15 and end around 45.
- We can see the x axis (secondary) at the top: It represents the weight (column D) in my dataset. Should start around 1100 and end around 2000.
- The Y axis (which is purposely chopped) only lists the models

The red crosses should represent the weight (column D) of each model.
The desired output should have as many bars as models, so in my case 10 bars (i've been doing so many reworks that I haven't kept tracked of all changes 😅)
 
Upvote 0
Link to spreadsheet

1723193234341.png



Probably about the best that can be achieved given the disparity in values between weight attachment and min and max weights. The foundation for this can be found at @Jon Peltier's page here, modified to suit. Note that there is an error on Jon's page at this instruction, as you must also check the box for 'Categories (X Labels) in First Column'.
1723193561188.png



tg2812.xlsx
ABCDEFG
1Weight (min)HelperWeight (max)Weight attachmentWeight attachment (x100)Height
2Model1182240145014.50.5
3Model2151530148214.821.5
4Model316824153015.32.5
5Model420828139013.93.5
6Model523932143014.34.5
7Model6181634187018.75.5
8Model7258331700176.5
9Model8251540128012.87.5
10Model9251540174117.418.5
11Model10201030120512.059.5
Sheet1
Cell Formulas
RangeFormula
C2:C11C2=D2-B2
F2:F11F2=E2/100
 
Upvote 0
Thank
Link to spreadsheet

View attachment 115180


Probably about the best that can be achieved given the disparity in values between weight attachment and min and max weights. The foundation for this can be found at @Jon Peltier's page here, modified to suit. Note that there is an error on Jon's page at this instruction, as you must also check the box for 'Categories (X Labels) in First Column'.
View attachment 115181


tg2812.xlsx
ABCDEFG
1Weight (min)HelperWeight (max)Weight attachmentWeight attachment (x100)Height
2Model1182240145014.50.5
3Model2151530148214.821.5
4Model316824153015.32.5
5Model420828139013.93.5
6Model523932143014.34.5
7Model6181634187018.75.5
8Model7258331700176.5
9Model8251540128012.87.5
10Model9251540174117.418.5
11Model10201030120512.059.5
Sheet1
Cell Formulas
RangeFormula
C2:C11C2=D2-B2
F2:F11F2=E2/100
Thank you for your reply. This is exactly what I needed. However, after reading the article you included as a reference, I do not understand how height is calculated and what is it for honestly. Could you please explain more simply for dummies ?
 
Upvote 0
When you add the series that becomes the crosses (the weight) it needs something to use as X values (which is vertical on a bar chart) because it is going to be converted to a scatter plot.
The height is just an X value for each point. Ideally you want it to plot aligned to the middle of each bar that it applies to, so in this case with 10 bars it is set to 0.5, 1.5, …, 9.5.

Does that help?

I also provided a downloadable excel worksheet - checking that you got that?
 
Upvote 0
When you add the series that becomes the crosses (the weight) it needs something to use as X values (which is vertical on a bar chart) because it is going to be converted to a scatter plot.
The height is just an X value for each point. Ideally you want it to plot aligned to the middle of each bar that it applies to, so in this case with 10 bars it is set to 0.5, 1.5, …, 9.5.

Does that help?

I also provided a downloadable excel worksheet - checking that you got that?
Yes, I have downloaded the excel file and it helps. Thank you.

However, I do not understand 1) which data (in my example) is the height derived from? 2) How to generate it, what are the steps to follow in Excel? I tried to follow the article but it is quite complicated ..
 
Upvote 0
As I want to add new models in my list, I do not know how to recalculate the height. Following the same pattern (0.5, 1.5...9.5..10.5), does not work anymore.
 
Upvote 0
Here's an example with 20 models so you can understand what's going on. Here are our starting data- shaded cells contain formulas.
  • As you already know you need a helper column to set the max weight for the bars.
  • The weight attachment is divided by 100 just to get it into a usable range of values.
  • The height I've calculated as =COUNTA(A$2:A2)-0.5, which is really just the model number or data point minus 0.5. You'll see why shortly.
tg2812.xlsx
ABCDEFG
1Weight (min)HelperWeight (max)Weight attachmentWeight attachment (x100)Height
2Model1182240145014.50.5
3Model2151530148214.821.5
4Model316824153015.32.5
5Model420828139013.93.5
6Model523932143014.34.5
7Model6181634187018.75.5
8Model7258331700176.5
9Model8251540128012.87.5
10Model9251540174117.418.5
11Model10201030120512.059.5
12Model11182240145014.510.5
13Model12151530148214.8211.5
14Model1316824153015.312.5
15Model1420828139013.913.5
16Model1523932143014.314.5
17Model16181634187018.715.5
18Model172583317001716.5
19Model18251540128012.817.5
20Model19251540174117.4118.5
21Model20201030120512.0519.5
Sheet1
Cell Formulas
RangeFormula
F2:F21F2=E2/100
G2:G21G2=COUNTA(A$2:A2)-0.5
C2:C21C2=D2-B2


The first thing to do is plot the weight bars. Select A1:C21 and insert a 2D stacked bar, which will give this:
1723259153032.png


Now select F1:G21, copy it and paste special into the graph using the following settings
1723259339423.png


Now the graph looks like this:
1723259424065.png


Right-click on the new bars (the green ones), select 'Change series chart type' and change it to an XY scatter (points only). It will automatically get put on the secondary axis. Here's what it looks like now, but the marker points have run amok. This is where the height value we calculated earlier comes in. The graph currently looks like this:
1723259741967.png


Right click on the secondary vertical axis, select format axis, and set the axis bounds to 0 and 20 (or whatever your highest model number is). And voila!
1723259977465.png


Now you can tidy it up - set the markers how you want them, hide the secondary vertical axis, remove the fill from the min weight, add a title etc.
 
Upvote 0
Thank you very much for your reply explanations. It is clearer.

However, I'm following exactly the same steps as you did but for some reasons when I change the axis bounds like in the last steps, the points are still running havoc. I do not know why but they are moving down the graph (see attached picture).

I do not know if one of my excel setting is wrong or not...
 

Attachments

  • IMG_4380.jpg
    IMG_4380.jpg
    88.1 KB · Views: 1
Upvote 0

Forum statistics

Threads
1,221,417
Messages
6,159,789
Members
451,589
Latest member
Harold14

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