This template takes up to 20 numbers and calculates the percent change between each pair and formats them for inclusion in a table in either ascending or descending order.

Use

This template has the following syntax:

{{Changes|number01|...|number20|order=|nd=|pd=|ic=|dc=}}

where:

  • number01|...|number20 are up to 20 numbers. If a number is not known, use NA or &#​32;
  • order= is an optional change calculation order:
    • order=a calculate percent change in ascending order. (default)
    • order=d calculate percent change in descending order.
  • nd= is an optional number of decimal places in the formatted numbers. (default=0)
  • pd= is an optional number of decimal places in the formatted percent changes. (default=2)
  • ic= is an optional color for a percent increase. (default=green)
  • dc= is an optional color for a percent decrease. (default=red)

Example

The following Wiki markup:

{|class="wikitable sortable"
![[美国州份|State]]
![[1980年美国人口普查|1980 Census]]
!% Pop Change
![[1990年美國人口普查|1990 Census]]
!% Pop Change
![[2000年美国人口普查|2000 Census]]
!% Pop Change
![[2010年美國人口普查|2010 Census]]
!% Pop Change
![[2020年美國人口普查|2020 Census]]
|-
|[[怀俄明州|Wyoming]]
{{changes|469557|453588|493782|563626|576851}}
|}

creates the following table:

State 1980 Census % Pop Change 1990 Census % Pop Change 2000 Census % Pop Change 2010 Census % Pop Change 2020 Census
Wyoming 469,557 −3.40% 453,588 +8.86% 493,782 +14.14% 563,626 +2.35% 576,851

You can put this table in descending order with {{changes|order=d|576851|563626|493782|453588|469557}}:

State 2020 Census % Pop Change 2010 Census % Pop Change 2000 Census % Pop Change 1990 Census % Pop Change 1980 Census
Wyoming 576,851 +2.35% 563,626 +14.14% 493,782 +8.86% 453,588 −3.40% 469,557

See also