See Help:Template#Parser_functions

http://www.westegg.com/inflation/


I'm not sure of any working examples, but I can explain how it could be done.
  1. If it's called as {{templatename|x|y}} then x and y can be accessed as template arguments {{{1}}} and {{{2}}}.
  2. y − c is simple enough. Use {{#expr:{{{2}}} - c}}.
  3. To use that expression as an offset into a table, wrap it in a #switch. For example:
    {{#switch:a
    |0=3
    |1=1
    |2=4
    |3=1
    |4=5
    |5=9
    (and so on)
    }}
    The data in a switch can be anything, by the way, text or more templates, not just numbers. The example data above are the decimal digits of pi.
  4. That gives the value for "b". Multiplying by x is another simple #expr: {{#expr:b * {{{1}}}}}
  5. So the whole thing would be something like:
    {{#expr:{{#switch:{{#expr:{{{2}}} - c}}|list of table values here}} * {{{1}}}}}
The main help resource for advanced expressions in template syntax is at mw:Help:Extension:ParserFunctions, but if you need more help feel free to ask me. • Anakin (talk) 14:40, 31 October 2009 (UTC)


seeUnited_States_dollar#Value.

see Template:USCensusPop

expression:

the United States is estimated to have 4.14% of the world's population.

{{#expr: {{data United States | Poptoday }} / {{worldpop}} * 100 round 2}}%