Template:Winning percentage
–
![]() | This template is used on approximately 37,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
This template calculates and displays the winning percentage for sports teams given three parameters: wins, losses and ties. Those three parameters are unnamed.
<syntaxhighlight lang="wikitext">Expression error: Unexpected < operator.</syntaxhighlight>
Wins and losses are required; ties are optional.
The result is displayed as a decimal point followed by three digits, as is standard in sports standings. Including |leading_zero=y
will add a leading 0 before the period (.), while adding |record=y
will show the record followed by the winning percentage.
In scenarios where ties are not regarded as half a win, using |ignore_ties=y
will omit ties and equate the winning percentage exactly as wins divided by the total number of games/matches played (i.e. wins plus draws plus losses).
Code | Result | Explanation | Calculation |
---|---|---|---|
<syntaxhighlight lang="wikitext" inline>.600</syntaxhighlight> | .600 | <win> / <total> | .600 = 30 / (30+20) |
<syntaxhighlight lang="wikitext" inline>.550</syntaxhighlight> | .550 | (<win> + (<ties>/2)) / <total> | .550 = (30+(50/2)) / (30+20+50) |
<syntaxhighlight lang="wikitext" inline>.300</syntaxhighlight> | .300 | <win> / <total-without-ties> | .300 = 30 / (30 + 20 + 50) |
<syntaxhighlight lang="wikitext" inline>100–50 (.667)</syntaxhighlight> | 100–50 (.667) | Showing records along with calculated percentage | |
<syntaxhighlight lang="wikitext" inline>100–50–3 (0.663)</syntaxhighlight> | 100–50–3 (0.663) | showing records and percentage with leading zero | |
<syntaxhighlight lang="wikitext" inline>0.667</syntaxhighlight> | 0.667 | show percentage with leading zero | |
<syntaxhighlight lang="wikitext" inline>1.000</syntaxhighlight> | 1.000 | 100% winning | |
<syntaxhighlight lang="wikitext" inline>.000</syntaxhighlight> | .000 | 0% winning | |
<syntaxhighlight lang="wikitext" inline>–</syntaxhighlight> | – | No match played, so a percentage is not mathematically possible |
Aliases
TemplateData
TemplateData for Winning percentage
This template calculates and displays the winning percentage for sports teams given three parameters: wins, losses and ties. Those three parameters are unnamed.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Wins | 1 | The number of wins to show.
| Number | required |
Losses | 2 | The amount of losses to show
| Number | required |
Ties | 3 | The amount of ties to show.
| Number | optional |
Record | record | Shows records along with calculated percentage
| String | optional |
Leading Zero | leading_zero | Whether to show a leading zero in the record.
| String | optional |
Ignore Ties | ignore_ties | In scenarios where ties are not regarded as half a win, enabling this will omit ties and equate the winning percentage exactly as wins divided by the total number of games/matches played (i.e. wins plus draws plus losses).
| String | optional |
See also
- {{Win-loss record}}
- {{Wins-losses-pct in table}}
- {{Percentage}}