Line graph with different colours depending on criteria

marc01

Board Regular
Joined
Sep 17, 2018
Messages
50
Office Version
  1. 2016
Platform
  1. Windows
Hi all.

I am looking to use a line graph to show momentum changes in a tennis match.
I have a column showing momentum change ( +1 whenever player A win's a point and -1 when player B win's the point). I have then used an IF function so show when player A wins the point but show NA () when player B win's. Then another column to show when player B wins the point and NA () when player A wins.

I have seen an example of this before where if player A wins the line in blue, if player B wins the line is yellow. Also the markers are either green if a winner is hit or red if an error is hit. I wanted to know if this is possible with Excel or if I would have to use power bi or the like?

Any help would be much appreciated.

Thanks.

Marc
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Managed to find the example I mention above. Any ideas?


GetAttachmentThumbnail
 
Upvote 0
Last edited:
Upvote 0
Brilliant, thanks Greg! I will take a look just now.
 
Upvote 0
Hi Greg,

Again thank you for pointing me in the right direction.

I have managed to get the 'correct' visualisation for the bar chart.

(sorry can't seem to successfully load image)

Below is a small selection of the data layout used to create this:

[TABLE="width: 954"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD]Maia Lumsden[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Set Score (xvalue)[/TD]
[TD]Momentum Total (yvalue)[/TD]
[TD][/TD]
[TD]Marie Serving[/TD]
[TD]Maia Serving[/TD]
[TD][/TD]
[TD]Server[/TD]
[TD][/TD]
[TD]IF(G3=$D$1,B3,"")[/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD]IF(G3=$E$1,B3,"")[/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-2[/TD]
[TD][/TD]
[TD="align: right"]-2[/TD]
[TD][/TD]
[TD][/TD]
[TD="colspan: 2"]Marie Benoit[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-3[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]-3[/TD]
[TD][/TD]
[TD="colspan: 2"]Maia Lumsden[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-2[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]-2[/TD]
[TD][/TD]
[TD="colspan: 2"]Maia Lumsden[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="colspan: 2"]Maia Lumsden[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="colspan: 2"]Maia Lumsden[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="colspan: 2"]Maia Lumsden[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

However, not the same success with the line graph. I have changed the IF function to =IF(G3=$D$1,B3,NA())

Therefore the data is:
[TABLE="width: 897"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD]Maia Lumsden[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Set Score (xvalue)[/TD]
[TD]Momentum Total (yvalue)[/TD]
[TD][/TD]
[TD]Marie Serving[/TD]
[TD]Maia Serving[/TD]
[TD][/TD]
[TD]Server[/TD]
[TD][/TD]
[TD="colspan: 2"]IF(G3=$D$1,B3,NA())[/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD="colspan: 2"]IF(G3=$E$1,B3,NA())[/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: right"]1[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: right"]-1[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-2[/TD]
[TD][/TD]
[TD="align: right"]-2[/TD]
[TD="align: center"]#N/A[/TD]
[TD][/TD]
[TD]Marie Benoit[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-3[/TD]
[TD][/TD]
[TD="align: center"]#N/A[/TD]
[TD="align: right"]-3[/TD]
[TD][/TD]
[TD]Maia Lumsden[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-2[/TD]
[TD][/TD]
[TD="align: center"]#N/A[/TD]
[TD="align: right"]-2[/TD]
[TD][/TD]
[TD]Maia Lumsden[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD="align: center"]#N/A[/TD]
[TD="align: right"]-1[/TD]
[TD][/TD]
[TD]Maia Lumsden[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: center"]#N/A[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD]Maia Lumsden[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]0-0[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD="align: center"]#N/A[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD]Maia Lumsden[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

However, following the procedure set out, this is creating a line graph with 3 seperate lines! I have actually copied and used the same data on the Peltier tech blog, and it worked perfectly.

Sorry, as you can tell I am not an excel whiz, so suspect I am making a mistake in doing something simple.

Any advice?

Cheers,

Marc
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,020
Members
452,542
Latest member
Bricklin

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