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:
Team 1
Team 2
Team 3
Team 4
Team 1
2-1
0-3
2-2
Team 2
1-0
1-2
0-0
Team 3
4-1
2-0
2-0
Team 4
2-1
1-1
0-2

<tbody>
</tbody>
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 :)
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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
Any particular reason why it has to be VBA?
 
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,214,985
Messages
6,122,607
Members
449,090
Latest member
vivek chauhan

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