Find zero in double number cell

honkin

Active Member
Joined
Mar 20, 2012
Messages
385
Office Version
  1. 2016
Platform
  1. MacOS
I have a column which has football scores in it. They are input as 2 digits and then formatted to contain a dash using the 0-0 format; as an example, 2-0 is input as 20, 4-1 is input as 41 and so on. The next column is to automate the result, so if there is a zero in the score anywhere, the result would be L and if there is not a zero, it is W
I tried using a wildcard to indicate 0* or *0, but have not been able to get it working correctly. This is what I tried =IF(OR(N2=*0, N2=0*), "L", "W")
So how does one indicate that a zero followed by any number or any number followed by zero is L, if both are false, then it is a W?
Thanks in advance
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
There are a couple of issues here. The score 0-0 is actually stored as 0. So there is no leading or trailing zero - it is simply zero. Select a cell with 0-0 to see how Excel stored that value. You can amend your formula to just test for the value 0 but I do not recommend that. The two scores for 1 game result should be in separate cells, not combined into a single cell. Using your current setup, how does it handle scores such as 0-12, or 10-11? I'm guessing you are seeing unintended results. I recommend split the scores for each game into separate columns.
 
Upvote 0
if there is a zero in the score anywhere, the result would be L and if there is not a zero, it is W
That seems a bit odd to me and I don't disagree with Andrew's comments, but if you insist on the current format, and given the description above, what about this?

24 04 01.xlsm
NO
1
22-0L
34-1W
40-2L
52-0L
62-2W
71-3W
83-3W
WL
Cell Formulas
RangeFormula
O2:O8O2=IF(ISNUMBER(FIND(0,TEXT(N2,"00"))),"L","W")
 
Upvote 0
Good to see you Peter.Did you see this part?
"They are input as 2 digits and then formatted to contain a dash using the 0-0 format"

The current setup stores input of 00 as 0, but displays it as 0-0. Whilst your solution works for single digit scores, it all gets a bit weird with scores of say 1-10 and 10-11 etc.
 
Upvote 0
Thanks for that.

Nice catch. I was looking for the unstated assumption but it could be games are stopped once a team reaches a score of 9 so that blows away my assumption..... :)
 
Upvote 0
There are a couple of issues here. The score 0-0 is actually stored as 0. So there is no leading or trailing zero - it is simply zero. Select a cell with 0-0 to see how Excel stored that value. You can amend your formula to just test for the value 0 but I do not recommend that. The two scores for 1 game result should be in separate cells, not combined into a single cell. Using your current setup, how does it handle scores such as 0-12, or 10-11? I'm guessing you are seeing unintended results. I recommend split the scores for each game into separate columns.
Cheers Andrew. Yes, you are correct...when I select a cell with 0-0, it shows as simply 0
 
Upvote 0
Hi Andrew
Good to see you back too!!


Yes I did. It specifically says the they are input as 2-digit numbers. If that is correct 1-10 and 10-11 will not occur as they would not be 2-digit numbers. :)
That seems a bit odd to me and I don't disagree with Andrew's comments, but if you insist on the current format, and given the description above, what about this?

24 04 01.xlsm
NO
1
22-0L
34-1W
40-2L
52-0L
62-2W
71-3W
83-3W
WL
Cell Formulas
RangeFormula
O2:O8O2=IF(ISNUMBER(FIND(0,TEXT(N2,"00"))),"L","W")
That seems to be exactly what I'm after. I fully get what Andrew was indicating, but the chances of a 3 digit score are very slim and this seems to do the job. Thanks very much for the effort
 
Upvote 0
Just throwing this out as a possibility:

Book1
NO
22-0L
34-1W
40-2L
52-0L
62-2W
71-3W
83-3W
Sheet1
Cell Formulas
RangeFormula
O2:O8O2=IF((N2>10)*RIGHT(N2),"W","L")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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