• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.154
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Percent and number

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Template documentation[view] [edit] [history] [purge]

This template may be used to generate a percentage of total followed by the number. For the reverse, see {{number and percent}}.

Contents

  • 1 Usage
    • 1.1 Optional parameters
  • 2 Basic examples
  • 3 Table display
  • 4 See also

Usage

  • {{percent and number|number|total}}
  • {{percent and number|number|total|decimals to round to (zero or greater)}}

Optional parameters

For two-column table output, use |disp=table

To insert a line break before the parenthetical expression, use |disp=br()

To add a prefix to the numbers, use |prefix=; for example, prefix=$

To add a suffix to the number, use |suffix=; for example, suffix= units

To pad the result with zeros to achieve the desired precision, use |pad=yes.

To override the default right alignment in table mode, use |align=left or |align=center.

Basic examples

{{percent and number|3333|20000}} → 17% (3,333)

{{percent and number|3333|20000|3}} → 16.665% (3,333)

{{percent and number|3,333|20,000}} → 17% (3,333)

{{percent and number|3,333|20,000|3}} → 16.665% (3,333)

{{percent and number|111|1000|4|pad=yes}} → 11.1000% (111)

{{percent and number|3333|20000|disp=br()}} → 17%
(3,333)

Table display

{| class="wikitable sortable"
|-
! Location !! Percentage !! Population 
|-
| City A || {{percent and number|5000|12000|disp=table}}
|-
| City B || {{percent and number|6500|12000|disp=table}}
|-
| City C || {{percent and number|500|12000|disp=table}}
|}
Location Percentage Population
City A 42% 5,000
City B 54% 6,500
City C 4% 500

See also

  • {{percentage}}
  • {{number and percent}}
The above documentation is transcluded from Template:Percent and number/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Percent_and_number&oldid=26792"
Category:
  • Mathematical function templates
Last edited on 11 May 2016, at 18:05

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 11 May 2016, at 18:05.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop