Conditional Formatting Colour in a Results Table

90sDave

New Member
Joined
Dec 18, 2014
Messages
2
Hi guys, I am fairly new to doing VBA coding stuff so if my question seems a bit obvious, that's why.

I am trying to do a results table for football like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Team 1
[/TD]
[TD]Team 2
[/TD]
[TD]Team 3
[/TD]
[TD]Team 4
[/TD]
[/TR]
[TR]
[TD]Team 1
[/TD]
[TD][/TD]
[TD]2-1
[/TD]
[TD]0-3
[/TD]
[TD]2-2
[/TD]
[/TR]
[TR]
[TD]Team 2
[/TD]
[TD]1-0
[/TD]
[TD][/TD]
[TD]1-2
[/TD]
[TD]0-0
[/TD]
[/TR]
[TR]
[TD]Team 3
[/TD]
[TD]4-1
[/TD]
[TD]2-0
[/TD]
[TD][/TD]
[TD]2-0
[/TD]
[/TR]
[TR]
[TD]Team 4
[/TD]
[TD]2-1
[/TD]
[TD]1-1
[/TD]
[TD]0-2
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I am trying to format the cells so that if the left hand number is bigger than the right, the cell colours green. If the right is bigger the cell colours red and if they are the same, yellow.
I have tried a few different ways to do this and it hasn't worked. I've also looked on the internet and can't find anything.
I am doing this in Excel 2010.
Can anyone help me out?
Thanks :smile:
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Highlight the cells starting from cell B2 and use 3 formulas like this
1. =IF(B2="","",1*LEFT(B2,FIND("-",B2)-1)>1*RIGHT(B2,LEN(B2)-FIND("-",B2)))=TRUE - choose to format with GREEN
2. =IF(B2="","",1*LEFT(B2,FIND("-",B2)-1)>1*RIGHT(B2,LEN(B2)-FIND("-",B2)))=FALSE -Choose to format with RED
3. =IF(B2="","",1*LEFT(B2,FIND("-",B2)-1)=1*RIGHT(B2,LEN(B2)-FIND("-",B2)))=TRUE -Choose to format with YELLOW

You should have the results like below

Excel 2010
ABCDE
1Team 1Team 2Team 3Team 4
2Team 12-10-32-2
3Team 21-01-20-0
4Team 34-12-02-0
5Team 42-11-10-2
Sheet2
 
Upvote 0
Hi,
Thanks for the help, but I was looking for a way to do it with VBA coding and this won't do that.
 
Upvote 0
@momentman
Woooowww! very good job.. i like this trick, i didn't know conditional formatting could do such a good things
 
Upvote 0
I think the second formula should be this instead =IF(B2="","",1*RIGHT(B2,LEN(B2)-FIND("-",B2))>1*LEFT(B2,FIND("-",B2)-1))=TRUE - format as Red
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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