[Solved] Create Bowls comp score sheet

Talk about anything at all....

[Solved] Create Bowls comp score sheet

Postby OXONBOD » Sun May 26, 2019 3:41 pm

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 Hagar Delest on Tue May 28, 2019 8:05 am, edited 1 time in total.
Reason: tagged solved
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.

Postby MrProgrammer » Sun May 26, 2019 10:26 pm

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.5 Build 9789 on MacOS 10.11.6.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
 
Posts: 3720
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Create Bowls comp score sheet

Postby OXONBOD » Mon May 27, 2019 10:24 am

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

Postby robleyd » Mon May 27, 2019 10:31 am

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 Developer Build 4.2.0 9820 - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 2767
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot] and 2 guests