How to calculate over or under based on dashed scores

honkin

Active Member
Joined
Mar 20, 2012
Messages
374
Office Version
  1. 2016
Platform
  1. MacOS
Hi

I have a sheet which records scores and other data from football matches around the world. I needed to be able to work out a winner from scores listed like 0-1, 2-2, 3-0 and so on

One of the members here offered a perfect formula which works well

=IF(LEFT(A1,FIND("-",A1)-1)+0>MID(A1,FIND("-",A1)+1,99)+0,"W","L")

I just change the > to < or = or <> depending on what sort of results I am monitoring

That all works well for determining a win or a draw, but how would it be amended to look for under or over a certain of goals?

Say I had a model which was backing Over 2.5 goals in a match; how would this be changed so it put a W or L if the score was >2 or <3? Obviously >2 means it is 3 or more and <3 means it is 2 or less, so will cover the 2.5 goals scenario. I can then change it depending on whether it is 2.5 goals, or 3.5 or even 0.5

Thanks in advance
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
thats pretty much what i posted

if the total goals are NOT greater than 2, then its a L

in my case , I used "below goal threshold" , so that part of the formula becomes L

I assume
0-3 = L
2-6 = L
as they are greater than 2 goals - BUT the right-hand-side scored more and so as convention they won

I also added an iferror for error handling, blank cells etc - IFERROR()

Book1
ABCDEF
1ResultGoalsthreshold codedthreshold 2Win/lose
21-01LLW
32-46LLL
46-17WWW
51-12LLL
62-57LLL
76-28WWW
81-23LLL
92-68LLL
106-39WWW
111-34LLL
12    example
131-12LLL1-1 L
142-13WWW2-1 W
150-00LLL0-0 L
161-01LLW1-0 L
173-03WWW3-0 W
Sheet2
Cell Formulas
RangeFormula
B2:B17B2=IFERROR(LEFT(A2,FIND("-",A2)-1)+0+MID(A2,FIND("-",A2)+1,99)+0,"")
C2:C17C2=IFERROR(IF((LEFT(A2,FIND("-",A2)-1)+0+MID(A2,FIND("-",A2)+1,99)+0) >2, IF( LEFT(A2,FIND("-",A2)-1)+0>MID(A2,FIND("-",A2)+1,99)+0,"W","L"), "L"),"")
D2:D17D2=IFERROR(IF((LEFT(A2,FIND("-",A2)-1)+0+MID(A2,FIND("-",A2)+1,99)+0) >RIGHT(D$1,1)+0, IF( LEFT(A2,FIND("-",A2)-1)+0>MID(A2,FIND("-",A2)+1,99)+0,"W","L"), "L"),"")
E2:E17E2=IFERROR(IF(LEFT(A2,FIND("-",A2)-1)+0>MID(A2,FIND("-",A2)+1,99)+0,"W","L"),"")
cheers etaf, but yours uses a helper column, which is not what I wish to use when unnecessary. I merely want score and result

Ta
 
Upvote 0
OK, keeping it simple, assuming single digit scores on either side, I think this should do what you want:

Book3.xlsx
AB
11-1L
22-1W
30-0L
41-0L
53-0W
Sheet1075
Cell Formulas
RangeFormula
B1:B5B1=IF(LEFT(A1)+RIGHT(A1)>2,"W","L")


And, in case for 2 digit scores, then:

Book3.xlsx
AB
11-1L
212-1W
30-1L
41-1L
53-10W
Sheet1075
Cell Formulas
RangeFormula
B1:B5B1=IF(LEFT(A1,FIND("-",A1)-1)+MID(A1,FIND("-",A1)+1,99)>2,"W","L")
That is exactly what I was after jtakw. Works like a charm

Thank you
 
Upvote 0
Glad you have a solution

just for any one else reading
NO Helper columns used at all - as i said in my post
and you can see from the formula - it only references column A
I have laid out various columns, for viewing , so you can see the formulas

so column C is all you need

as shown again

I have a different result , as you have a W if its greater than 2 goals - regardless of which side won - I assume that is what you want
But just in case others are looking for a similar solution
for example
4-7
would be a lose , as its still over 2 goals - but the right hand side won

Book1
ACFG
1Resultthreshold coded
12 example
131-1L1-1 LL
142-1W2-1 WW
150-0L0-0 LL
161-0L1-0 LL
173-0W3-0 WW
184-7LW
Sheet2
Cell Formulas
RangeFormula
C12:C18C12=IFERROR(IF((LEFT(A12,FIND("-",A12)-1)+0+MID(A12,FIND("-",A12)+1,99)+0) >2, IF( LEFT(A12,FIND("-",A12)-1)+0>MID(A12,FIND("-",A12)+1,99)+0,"W","L"), "L"),"")
G13:G18G13=IF(LEFT(A13,FIND("-",A13)-1)+MID(A13,FIND("-",A13)+1,99)>2,"W","L")
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

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