Usage ของ แม่แบบ:Inflation

{{Inflation|index|value|start_year}}{{Inflation|index|value|start_year|end_year}}{{Inflation|index|value|start_year|r=decimals|fmt=c}}{{Inflation|index|value|start_year|r=decimals|fmt=eq}}{{Inflation|index|value|start_year|r=decimals|fmt=eq|cursign=X}}

The supported countries are listed below, with their index and available data periods:

indexCountrystart_year minimumend_year maximum
AUAustralia[2]แม่แบบ:Inflation/AU/startyear2018
AU-roadAustralia [...?][3]แม่แบบ:Inflation/AU-road/startyear2018
BDBangladesh[4]แม่แบบ:Inflation/BD/startyear2014
CACanada[5]แม่แบบ:Inflation/CA/startyear2020
DEGermany[6]แม่แบบ:Inflation/DE/startyear2017
INIndia[7]19532019
JPJapan[8]แม่แบบ:Inflation/JP/startyear2019
PHPhilippines[9]แม่แบบ:Inflation/PH/startyear2019
PKPakistan[10]แม่แบบ:Inflation/PK/startyear2019
UKUnited Kingdom[11]แม่แบบ:Inflation/UK/startyear2019
UK-GDPUnited Kingdom GDP deflator[12]แม่แบบ:Inflation/UK-GDP/startyear2019
USUnited States[13]16342020
US-GDPUnited States GDP deflator[14]แม่แบบ:Inflation/US-GDP/startyear2019
ZARSouth Africa[15]แม่แบบ:Inflation/ZAR/startyear2018
KRWSouth Korea[16]แม่แบบ:Inflation/KRW/startyear2017

Parameters

  • |index= (parameter 1), required, an index code for one of several available inflation indexes.
  • |value= (parameter 2), required, original price or value from which to base the inflation calculation on. Will ignore any commas, but must not have a currency symbol.
  • |start_year= (parameter 3), required, original year from which to base the inflation calculation on. Must be a year available in the chosen inflation index. As an exception to this, if the current year is specified and no end_year is specified, the template will output value unchanged, as it can be assumed an inflation of zero.
  • |end_year= (parameter 4), optional, reference year for which to calculate inflation. Must be higher (later) than start_year, but not higher than the highest (most recent) year available in the chosen inflation index, and will default to the highest (most recent) available year if omitted.
  • |r=digit sets the digits to which the value must be rounded. A negative value indicates rounding to an upper significant digit, and a positive value indicates a fractional digit including trailing zeros. Defaults to 0, i.e., without cents.
  • |fmt=c will insert thousands separator commas into the calculated value.
  • |fmt=eq will show an equivalent-to phrase, in the format, "equivalent to cursignend_value in end_year". Uses thousands separator commas.
    • |cursign= will set the currency symbol to be shown. Only functions when |fmt=eq is used. Can use advanced symbol formats, but can only precede the calculated value. Default is $.

Examples

  • Y {{Inflation|DE|100|2000}} → Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index.
  • Y {{Inflation|US|595|1982}} → 1596
  • Y {{Inflation|US|595|1982|fmt=eq}} → equivalent to $1,596 in 2020
  • Y {{Inflation|US|800|1942|fmt=eq|r=-3}} → equivalent to $13,000 in 2020
  • Y {{Inflation|US|100|2010|2012|fmt=eq|r=2}} → equivalent to $105.28 in 2012
  • Y US$595 ({{Inflation|US|595|1982|fmt=eq}}) → US$595 (equivalent to $1,596 in 2020)
  • Y US$595 ({{Inflation|US|595|1982|fmt=eq|cursign=[[United States dollar|US$]]}}) → US$595 (equivalent to US$1,596 in 2020)
  • Y $21 million (equivalent to ${{Inflation|US|21|2005|r=2}} million in {{Inflation/year|US}}) → $21 million (equivalent to $27.83 million in 2020)
  • Y {{Inflation|UK|1|1209|fmt=eq|cursign=£}} → Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index.
  • Y {{Inflation|AU|100|2021|fmt=eq}} → Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • Y ${{Inflation|US|100|2021}} in {{Inflation/year|US}} → $100 in 2020

It is possible to use the template in incorrect ways without producing error messages. Please read the warnings and appropriate uses of this template at the beginning of the template description.

  • N {{Inflation|UK|10|1971|fmt=eq}} → Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index. (Omitting the |cursign= parameter will show the $ symbol by default, which is the wrong currency symbol for British currency)
  • Y {{Inflation|UK|10|1971|fmt=eq|cursign=£}} → Error when using {{Inflation}}: |index=UK (parameter 1) not a recognized index.
  • N $595 (${{Inflation|US|595|1982|fmt=c}} today) → $595 ($1,596 today) (Misleading time reference)
  • N $595 (${{Inflation|US|595|1982|fmt=c}} in {{CURRENTYEAR}}) → $595 ($1,596 in 2021) (Misleading time reference)
  • N $100 (${{Inflation|US|595|1982|fmt=c}} adjusted for inflation) → $100 ($1,596 adjusted for inflation) (Misleading time reference)
  • Y $595 ({{Inflation|US|595|1982|fmt=eq}}) → $595 (equivalent to $1,596 in 2020)
  • Y $595 (equivalent to ${{Inflation|US|595|1982|fmt=c}} in {{Inflation/year|US}}) → $595 (equivalent to $1,596 in 2020)
  • N Jane Doe amassed a fortune of $1 billion in 1975, making her worth ${{Inflation|US|1|1975|fmt=c}} billion in {{Inflation/year|US}}. → Jane Doe amassed a fortune of $1 billion in 1975, making her worth $5 billion in 2020. (CPI is not for personal wealth of the wealthy – use GDP deflator instead)
  • N Jane Doe amassed a fortune of $1 billion in 1975, equivalent to ${{Inflation|US|1|1975|fmt=c}} billion in {{Inflation/year|US}}. → Jane Doe amassed a fortune of $1 billion in 1975, equivalent to $5 billion in 2020. (CPI is not for personal wealth of the wealthy – use GDP deflator instead)
  • Y Jane Doe amassed a fortune of $1 billion in 1975, equivalent to ${{Inflation|US-GDP|1|1975|fmt=c}} billion in {{Inflation/year|US-GDP}}. → Jane Doe amassed a fortune of $1 billion in 1975, equivalent to $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. billion in 2019

Entering invalid parameters or omitting required parameters will result in an error message and categorization into Category:Pages with errors in inflation template.

  • N {{Inflation}} → Error when using {{Inflation}}: |index= (parameter 1), |value= (parameter 2) and |start_year= (parameter 3) must be specified.
  • N {{Inflation|abc}} → Error when using {{Inflation}}: |value= (parameter 2) and |start_year= (parameter 3) must be specified.
  • N {{Inflation|AU}} → Error when using {{Inflation}}: |value= (parameter 2) and |start_year= (parameter 3) must be specified.
  • N {{Inflation|AU|100}} → Error when using {{Inflation}}: |start_year= (parameter 3) must be specified.
  • N {{Inflation|abc|€100|1980}} → Error when using {{Inflation}}: |index=abc (parameter 1) not a recognized index.
  • N {{Inflation|DE|€100|1980}} → Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index.
  • N {{Inflation|DE|€100|zzzz|zzzz|r=zzzz}} → Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index.
  • N {{Inflation|AU|100|1200|2022}} → Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • N {{Inflation|AU|100|2005|2004}} → Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index. (see the Limitations section below)
  • N {{Inflation|AU|100|2005|2022|fmt=eq}} → Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • N {{Inflation|AU|100|2021|2022|fmt=eq}} → Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • N {{Inflation|AU|100|2021|1905|fmt=eq}} → Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.
  • N {{Inflation|AU|100|2022|fmt=eq}} → Error when using {{Inflation}}: |index=AU (parameter 1) not a recognized index.

Tips & tricks

Currency conversion

This template is currency agnostic, which means it doesn't convert between different currencies. Thus, if you wanted to know how much DM 1,000.00 marks in 1960 are worth nowadays, entering {{Inflation|DE|1000|1960|r=2}} would provide a result (Error when using {{Inflation}}: |index=DE (parameter 1) not a recognized index.) still in marks, not in euros.

Consequently, if you need a result in another currency than the one in which the original value is stated, for now you must do the conversion manually, as in the following example which uses the defined conversion rate of € 1 = DM 1.95583:

  • Y {{#expr:({{Inflation|DE|1000|1960|r=2}} / 1.95583) round 2}}ข้อผิดพลาดนิพจน์: มีตัวดำเนินการ < ซึ่งไม่ควรมี

แม่แบบ:ToDo A currency conversion template to ease these conversion tasks is planned. This section will be updated accordingly once it's developed.

Non-decimal inputs

The template does not accept non-decimal inputs such as £sd; these must be decimalized beforehand. For example, if you wanted to know the value of three shillings and sixpence (3s 6d) Sterling in 1950 in 2018, you must convert to the appropriate decimal value (in this case £0.175) for use in the template:

  • Y {{Inflation|GBP|0.175|1950|2018}}Error when using {{Inflation}}: |index=GBP (parameter 1) not a recognized index.

For £sd specifically {{Pounds, shillings, and pence}} can be used to convert to decimal; for other non-decimal currencies, such as the old Indian rupee, templates can be made for decimalization upon request.

Rounding

By default the values are calculated to the unit, as for all but very low values cents are undesirable. You can specify rounding with the |r= parameter which determines the number of decimals. To obtain cents use |r=2, but other values can be used, including negative ones: |r=-3, for example, will round to the nearest thousand, |r=-6 to the nearest million, and so on. It is advisable to avoid excessive precision; even if the start value is known to be exact, the template's result will not be because the inflation index tables are rarely accurate to more than about 1%, and a granularity of whole years is used.

Very large results

Very large results are expressed in scientific notation ("1.2E+14" instead of "120000000000000") which is normally not desirable. A workaround is to express the value to be inflated with fewer digits, adding a multiplier text such as "trillion" after the result, using the "Show preview" button as many times as needed, changing parameters until the best result is found:

  • Y ${{Inflation|US-GDP|1000000000000|1900|r=-11|fmt=c}} → $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index.
  • N ${{Inflation|US-GDP|10000000000000|1900|r=-12|fmt=c}} → $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index.
  • N ${{Inflation|US-GDP|10000000000|1900|r=-9|fmt=c}}&nbsp;thousand → $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. thousand
  • Y ${{Inflation|US-GDP|10000000|1900|r=-6|fmt=c}}&nbsp;million → $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. million
  • Y ${{Inflation|US-GDP|10000|1900|r=-3|fmt=c}}&nbsp;billion → $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. billion
  • Y ${{Inflation|US-GDP|10|1900|fmt=c}}&nbsp;trillion → $Error when using {{Inflation}}: |index=US-GDP (parameter 1) not a recognized index. trillion

The following section provides an automated way of avoiding this trial and error scenario.

Format price

{{Format price}} is a template specifically designed to display price values, both big and small, in a readable way. For example, instead of showing the whole of a huge number such as "953,783,409,856.12", it would show it as "954 billion", while small numbers have their cents part appearing as expected, "1234.5" being properly shown as "1.23 thousand".

Documenting

It's a good practice to provide a valid reference for the prices calculated with this template in articles where it's used. The template {{Inflation/fn}} was developed to ease this task. It accepts as its single parameter the same country codes used here, and will generate one or more appropriate footnotes. Typically, this is how a piece of text using it looks like:

  • In 1985 a unit cost on average $1,040. This is {{Inflation|US|1040|1985|fmt=eq}}.{{Inflation/fn|US}}

Resulting in this converted code (notice the footnote link at the end):

  • In 1985 a unit cost on average $1,040. This is equivalent to $2,503 in 2020.[13]

The footnote thus generated appears whenever {{reflist}} or <references /> is used in an article, usually in its "References" section. See below for the live example in this document's own References section, or click the above generated footnote to jump to it.

Limitations

  1. Currently it isn't possible to "de-inflate" a value to what it would have been in a previous year. If you need this functionality, please request it at the talk page. Adding it won't be difficult, but there's no point in doing so before someone actually needs it.
  2. Substitution isn't supported at all. Trying to {{subst:Inflation|...}} would only result in a long sequence of embedded parser code without any direct benefit. If you need to obtain an inflated price only once, please use the special ExpandTemplates page then copy the result and paste it at the desired location.

แหล่งที่มา

WikiPedia: แม่แบบ:Inflation http://www.abs.gov.au/AUSSTATS/abs@.nsf/Lookup/642... http://www.indexmundi.com/facts/bangladesh/consume... http://www.indexmundi.com/facts/south-africa/consu... http://www.measuringworth.com/datasets/ukgdp/ http://www.measuringworth.com/datasets/usgdp/ http://www.rateinflation.com/consumer-price-index/... http://shouwashi.com/transition-consumerprice.html http://www.inflation.eu/inflation-rates/india/hist... http://www.index.go.kr/potal/stts/idxMain/selectPo... http://dx.doi.org/10.2139/ssrn.2881432