## [Solved] Create Bowls comp score sheet

### [Solved] Create Bowls comp score sheet

I am trying to create a score sheet for a charity Bowls competition.
I need to award points as follows: If team A scores more shots than team B, team A will be awarded 2 points and team B will be awarded none. The reverse is also true. Then, if both teams score the same number of shots, they will both be awarded 1 point each.

I have got as far as the following bit of code =IF(A2>B2;2;0) that awards points if A scores more than B or none if the score I less. What I cant figure out is how to include a test for equal scores that then awards one point each.
Last edited by MrProgrammer on Tue Jul 09, 2019 9:49 pm, edited 2 times in total.
Reason: Moved from General Discussion to Calc forum -- MrProgrammer 2019-07-09 14:48
Open office version is 4.1.5: Operating system is Windows 10.
OXONBOD

Posts: 2
Joined: Sun May 26, 2019 12:27 pm

### Re: Creat Bowls comp score sheet.

Hi, and welcome to the forum.

OXONBOD wrote:If team A scores more shots than team B, team A will be awarded 2 points and team B will be awarded none. The reverse is also true. Then, if both teams score the same number of shots, they will both be awarded 1 point each.
Assuming A's score in A2 and B's score in B2:
A's points: =SIGN(A2-B2)+1
B's points: =SIGN(B2-A2)+1
«or»
A's points: =(A2>B2)+(A2>=B2)
B's points: =(B2>A2)+(B2>=A2)

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800 on MacOS 10.14.6.   The locale for any menus or Calc formulas in my posts is English (USA).

MrProgrammer
Moderator

Posts: 3962
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

### Re: Create Bowls comp score sheet

Many thanks. The second set of code works fine. Could you explain how it works?
Open office version is 4.1.5: Operating system is Windows 10.
OXONBOD

Posts: 2
Joined: Sun May 26, 2019 12:27 pm

### Re: Create Bowls comp score sheet

From Section 1 of the tutorial MrProgrammer linked above:
The special values TRUE and FALSE are really numbers. TRUE has the value 1 and FALSE has the value 0

A2>B2 is either TRUE or FALSE; similarly A2>=B2 is either TRUE or FALSE.
Cheers
David
Apache OpenOffice 420m2(Build:9821) - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine

robleyd
Moderator

Posts: 3308
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia