Compare number before dash to number after dash

honkin

Active Member
Joined
Mar 20, 2012
Messages
385
Office Version
  1. 2016
Platform
  1. MacOS
I have a sheet which keeps records of football (soccer) matches all over Europe. The scores come in like this 1-0, 2-1 and so on, but I'd like to be able to have the results column automatically update based on the native score, without using a helper column.

Is there a way to do something like , IF before the - is >= after the dash, then W, L?

Thanks in advance
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

Something like this:

Book3.xlsx
AB
11-0W
22-1W
32-5L
411-3W
Sheet1066
Cell Formulas
RangeFormula
B1:B4B1=IF(LEFT(A1,FIND("-",A1)-1)+0>MID(A1,FIND("-",A1)+1,99)+0,"W","L")
 
Upvote 0
Solution
Try this
=IF(LEFT(A2,FIND("-",A2)-1)>REPLACE(A2,1,FIND("-",A2),""),"W","L")
 
Upvote 0
@V51773

You'll need to convert the LEFT and REPLACE results to Real Numbers for it to work correctly. (I.e. *1, +0, -- )
 
Upvote 0
Hi,

Something like this:

Book3.xlsx
AB
11-0W
22-1W
32-5L
411-3W
Sheet1066
Cell Formulas
RangeFormula
B1:B4B1=IF(LEFT(A1,FIND("-",A1)-1)+0>MID(A1,FIND("-",A1)+1,99)+0,"W","L")
cheers jtakw.

That formula seems to work fine. So if I want it to work in reverse, I figure I just change the > to < and if I want to do draws it would be = and if I do NOT want draws it would be <> yeah?

Just trying to have a way that will work in the various sheets, some picking the home team to win, some picking the away team, some picking the draw and some picking the draw NOT to happen.

Just on testing, it works with <> on the sheet which picks the draw NOT to happen, so I think this is perfect.

Thanks so much
 
Upvote 0
cheers jtakw.

That formula seems to work fine. So if I want it to work in reverse, I figure I just change the > to < and if I want to do draws it would be = and if I do NOT want draws it would be <> yeah?

Just trying to have a way that will work in the various sheets, some picking the home team to win, some picking the away team, some picking the draw and some picking the draw NOT to happen.

Just on testing, it works with <> on the sheet which picks the draw NOT to happen, so I think this is perfect.

Thanks so much

Yes, you should be able to achieve those results as you described.
 
Upvote 0
If cell A2 is 2-2, what do you want the result to be?

.
Cheers Phuoc
Depends on what the model is looking at, but I have everything I need from the post #2 above. Simply changing the > to < or = or <> will cover most things. The only thing I can yet do is over or under a certain number like 2 for example. I'll start another thread for that, though

Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,905
Messages
6,175,297
Members
452,633
Latest member
DougMo

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