Formula Help IF Above Row Value is Greater than Below Row Value

parvezs27

New Member
Joined
Jun 27, 2022
Messages
15
Office Version
  1. 365
Platform
  1. Windows
Hi!

I have a table with Australian Football League Statistics. For column E "Disposal W/L", if D2 value is greater than D3 value then "W" if false then "L" and then if D4 value is greater than D5 value then "W" if false then "L" and so on.

I tried =IF(D2>D3, "W", "L") but that moves down and it's not correct. I just want to compare D2 with D3 and then D4 with D5 and then D6 with D7 and so on.

Would appreciate any help for a beginner here, thanks!

Ovens and Murray League Macro Enabled.xlsm
ABCDEFGHIJK
1RoundTeamWin/LoseTotal DisposalsDisposal W/LContested DisposalsContested Disposal W/LUncontested DisposalsUncontested Disposals W/LTotal KicksTotal Kicks W/L
21Wangaratta MagpiesW31853265222
31AlburyL32181240211
41LavingtonL27591184192
51Corowa-RutherglenW35583272203
61MyrtlefordW27085185206
71Wangaratta RoversL28682204208
82AlburyW395122273240
92WodongaL385104281215
102Wangaratta MagpiesW347138209214
112Wangaratta RoversL29393200193
122LavingtonW28890198208
132MyrtlefordL32396227210
142Wodonga RaidersL26882186197
152YarrawongaW355117238241
162North AlburyL30683223184
172Corowa-RutherglenW39871327232
182Wangaratta RoversW38889299227
192Wodonga RaidersL35280272227
202Corowa-RutherglenL348105243209
212AlburyW34699247213
222WodongaL37687289224
232Wangaratta MagpiesW34480264228
242LavingtonL26070190195
252YarrawongaW322112210219
262North AlburyL25678178150
272MyrtlefordW35272280233
283LavingtonL341100241219
293Wangaratta RoversW372118254231
303Corowa-RutherglenL270114156151
Match Data
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
You can use the IF and MOD functions in combination to achieve this. The MOD function returns the remainder of a division, so you can use it to check if a cell is even or odd.

For example, the formula in cell E2 would be:
Excel Formula:
=IF(D2>D3,"W","L")

And then in E3 you can use:
Excel Formula:
=IF(D4>D5, "W", "L")

You can drag down this formula for the rest of the columns.

Alternatively, you can use the following formula in E2 and drag it down for the rest of the columns:
Excel Formula:
=IF(MOD(ROW(),2)=0,IF(D2>D3,"W","L"),IF(D4>D5,"W","L"))

This formula uses the MOD function to check if the row number is even (D2 and D3) or odd (D4 and D5) and then uses the IF function to compare the values and return "W" or "L" accordingly.
 
Upvote 0
How about
Fluff.xlsm
ABCDEFGHIJK
1RoundTeamWin/LoseTotal DisposalsDisposal W/LContested DisposalsContested Disposal W/LUncontested DisposalsUncontested Disposals W/LTotal KicksTotal Kicks W/L
21Wangaratta MagpiesW318L53265222
31AlburyL321W81240211
41LavingtonL275L91184192
51Corowa-RutherglenW355W83272203
61MyrtlefordW270L85185206
71Wangaratta RoversL286W82204208
82AlburyW395W122273240
92WodongaL385L104281215
102Wangaratta MagpiesW347W138209214
112Wangaratta RoversL293L93200193
122LavingtonW288L90198208
132MyrtlefordL323W96227210
142Wodonga RaidersL268L82186197
152YarrawongaW355W117238241
162North AlburyL306L83223184
172Corowa-RutherglenW398W71327232
182Wangaratta RoversW388W89299227
192Wodonga RaidersL352L80272227
202Corowa-RutherglenL348W105243209
212AlburyW346L99247213
222WodongaL376W87289224
232Wangaratta MagpiesW344L80264228
242LavingtonL260L70190195
252YarrawongaW322W112210219
262North AlburyL256L78178150
272MyrtlefordW352W72280233
283LavingtonL341L100241219
293Wangaratta RoversW372W118254231
303Corowa-RutherglenL270W114156151
31
Main
Cell Formulas
RangeFormula
E2:E30E2=LET(s,SEQUENCE(ROWS(FILTER(B2:B100,B2:B100<>""))),IF(MOD(s,2)=1,IF(INDEX(D2:D100,s)>INDEX(D2:D100,s+1),"W","L"),IF(INDEX(D2:D100,s)>INDEX(D2:D100,s-1),"W","L")))
Dynamic array formulas.
 
Upvote 0
.. or this spillable one?
(I'm assuming the original data was simply cut off at row 30 for the sample as there is an odd number of values listed for round 3)

23 01 14.xlsm
DE
1Total DisposalsDisposal W/L
2318L
3321W
4275L
5355W
6270L
7286W
8395W
9385L
10347W
11293L
12288L
13323W
14268L
15355W
16306L
17398W
18388W
19352L
20348W
21346L
22376W
23344L
24260L
25322W
26256L
27352W
28341L
29372W
30270W
WL
Cell Formulas
RangeFormula
E2:E30E2=IF(D2:D30>IF(ISODD(ROW(F2:F30)-ROW(F2)),D1:D29,D3:D31),"W","L")
Dynamic array formulas.


BTW, Doesn't it need to allow for the case where disposals in a match are equal? The above formula would return "L" for both teams in that scenario which does not seem right.

23 01 14.xlsm
DE
1Total DisposalsDisposal W/L
2318D
3318D
4275L
5355W
6270L
7286W
8395W
9385L
10347W
11293L
12288L
13323W
14268L
15355W
16306L
17398W
18388W
19352L
20348D
21348D
22376W
23344L
24260L
25322W
26256L
27352W
28341L
29372W
30270W
WL (2)
Cell Formulas
RangeFormula
E2:E30E2=MID("LDW",SIGN(D2:D30-IF(ISODD(ROW(G2:G30)-ROW(G2)),D1:D29,D3:D31))+2,1)
Dynamic array formulas.
 
Upvote 0
If you are not particularly keen to have a single spillable formula at the top and are happy to copy down, you could put these two much simpler formulas in E2 and E3 and then select both cells (E2:E3) and drag the Fill Handle down.

23 01 14.xlsm
DE
1Total DisposalsDisposal W/L
2318D
3318D
4275L
5355W
6270L
7286W
8395W
9385L
10347W
11293L
12288L
13323W
14268L
15355W
16306L
17398W
18388W
19352L
20348D
21348D
22376W
23344L
24260L
25322W
26256L
27352W
28341L
29372W
30270W
WL (3)
Cell Formulas
RangeFormula
E2,E4,E6,E8,E10,E12,E14,E16,E18,E20,E22,E24,E26,E28,E30E2=IF(D2>D3,"W",IF(D2=D3,"D","L"))
E3,E5,E7,E9,E11,E13,E15,E17,E19,E21,E23,E25,E27,E29E3=IF(D3>D2,"W",IF(D3=D2,"D","L"))
 
Upvote 0
Solution
If you are not particularly keen to have a single spillable formula at the top and are happy to copy down, you could put these two much simpler formulas in E2 and E3 and then select both cells (E2:E3) and drag the Fill Handle down.

23 01 14.xlsm
DE
1Total DisposalsDisposal W/L
2318D
3318D
4275L
5355W
6270L
7286W
8395W
9385L
10347W
11293L
12288L
13323W
14268L
15355W
16306L
17398W
18388W
19352L
20348D
21348D
22376W
23344L
24260L
25322W
26256L
27352W
28341L
29372W
30270W
WL (3)
Cell Formulas
RangeFormula
E2,E4,E6,E8,E10,E12,E14,E16,E18,E20,E22,E24,E26,E28,E30E2=IF(D2>D3,"W",IF(D2=D3,"D","L"))
E3,E5,E7,E9,E11,E13,E15,E17,E19,E21,E23,E25,E27,E29E3=IF(D3>D2,"W",IF(D3=D2,"D","L"))

Thank you very much for this! And for bringing to my attention that there needs to be a label when disposals in the match are equal. Much appreciated.
 
Upvote 0
You're welcome. Glad we could help. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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