[Solved] Create Bowls comp score sheet

Discuss the spreadsheet application
Post Reply
OXONBOD
Posts: 2
Joined: Sun May 26, 2019 12:27 pm

[Solved] Create Bowls comp score sheet

Post by OXONBOD »

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.
User avatar
MrProgrammer
Moderator
Posts: 4903
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Creat Bowls comp score sheet.

Post by MrProgrammer »

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, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
OXONBOD
Posts: 2
Joined: Sun May 26, 2019 12:27 pm

Re: Create Bowls comp score sheet

Post by OXONBOD »

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.
User avatar
robleyd
Moderator
Posts: 5079
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Create Bowls comp score sheet

Post by robleyd »

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
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Post Reply