Comparing two ranges for where one of the values is equal to one more

Civitas

New Member
Joined
Dec 2, 2014
Messages
4
Hi all,
Please see soccer data below. Although it's fairly easy to do a 'more than' between two values. Can someone point me in the right direction to find scores were the winner has won by only by one goal? Can this only be done in VBA?

Any pointers in the correct direction would be most helpful.

Civi.


[TABLE="width: 342"]
<colgroup><col span="2"><col span="2"></colgroup><tbody>[TR]
[TD]HomeTeam[/TD]
[TD]AwayTeam[/TD]
[TD]FTHG[/TD]
[TD]FTAG[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Dortmund[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Stuttgart[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Freiburg[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]M'gladbach[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Wolfsburg[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Mainz[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Hoffenheim[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Braunschweig[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Werder Bremen[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Nurnberg[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Hannover[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Schalke 04[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Leverkusen[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Bayern Munich[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Hertha[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Hamburg[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Augsburg[/TD]
[TD]Ein Frankfurt[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]M'gladbach[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Nurnberg[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Hannover[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Wolfsburg[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Mainz[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Hertha[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Augsburg[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Braunschweig[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Hamburg[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Ein Frankfurt[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Freiburg[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Schalke 04[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Leverkusen[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Hoffenheim[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Dortmund[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Werder Bremen[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Bayern Munich[/TD]
[TD]Stuttgart[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Werder Bremen[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Ein Frankfurt[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Nurnberg[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Stuttgart[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Schalke 04[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Leverkusen[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Freiburg[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Hertha[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Hoffenheim[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Dortmund[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Hamburg[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]M'gladbach[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Wolfsburg[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Mainz[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Hannover[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Bayern Munich[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Braunschweig[/TD]
[TD]Augsburg[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Here's one way. Another would be to use conditional formatting to highlight records where the win margin is 1 point.
Excel Workbook
ABCDE
1HomeTeamAwayTeamFTHGFTAG1-Pt win
2AugsburgDortmund04 
3AugsburgStuttgart211-Point Win
4AugsburgFreiburg211-Point Win
5AugsburgM'gladbach22
6AugsburgWolfsburg121-Point Win
7AugsburgMainz211-Point Win
8AugsburgHoffenheim20
9AugsburgBraunschweig41
10AugsburgWerder Bremen31
11AugsburgNurnberg011-Point Win
12AugsburgHannover11
13AugsburgSchalke 04121-Point Win
14AugsburgLeverkusen13
15AugsburgBayern Munich101-Point Win
16AugsburgHertha00
17AugsburgHamburg31
18AugsburgEin Frankfurt211-Point Win
Sheet7
 
Upvote 0
Civi,

Something like....

Excel 2007
ABCDE
1HomeTeamAwayTeamFTHGFTAGWon by only 1 goal?
2AugsburgDortmund04 
3AugsburgStuttgart21Yes
4AugsburgFreiburg21Yes
5AugsburgM'gladbach22
6AugsburgWolfsburg12Yes
7AugsburgMainz21Yes
8AugsburgHoffenheim20
9AugsburgBraunschweig41
10AugsburgWerder Bremen31
11AugsburgNurnberg01Yes
12AugsburgHannover11
13AugsburgSchalke 0412Yes
Sheet2
Cell Formulas
RangeFormula
E2=IF(ABS(C2-D2)=1,"Yes","")


Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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