Jump to content

Template:Get cell/doc

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Sophivorus (talk | contribs) at 22:20, 29 April 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This template serves to calculate a table cell out of the values of other cells.

Example

The following wikitext:

{| class="wikitable" id="population-table"
! Country
! Population
! Area
! Density
|-
| Argentina
| 45,773,884
| 2,796,427
| {{Calculated cell|B2/B3 round 0|population-table}}
|-
| China
| 1,425,671,352
| 9,600,000
| {{Calculated cell|C2/C3 round 0|population-table}}
|-
| United States
| 339,996,564
| 9,833,517
| {{Calculated cell|D2/D3 round 0|population-table}}
|}

Outputs the following table:

Country Population Area Density
Argentina 45,773,884 2,796,427 Template:Calculated cell
China 1,425,671,352 9,600,000 Template:Calculated cell
United States 339,996,564 9,833,517 Template:Calculated cell

Note that this template internally formats the values from B2 and B3 into plain numbers (without commas) to be able to do the division.