Formatting Numbers
Copy and paste these to get your perfect formatting:
You must use the Number or Integer question type to use these functions. If you use a Number, decimal points will show by default. If you use an Integer, you will have a whole number.
In the examples below, replace variablename with your own variable name.
Currency (ex. $100,000.00 with $, commas, and two decimal points)
{{ currency(variablename) }}
No Decimal Points, No Commas (ex. 100000)
{{ Decimals0NoCommas(variablename) }}
2 Decimal Points, With Commas (ex. 100,000.00)
{{ Decimals2Commas(variablename) }}
0 Decimal Points, With Commas (ex. 100,000)
{{ Decimals0Commas(variablename) }}
Custom variation of decimals/commas
Replace the number 2 below with the number of decimal points you want:
With commas: {{ format_decimal(variablename, 2) }}
Without commas: {{ format_decimal(variablename, 2, False) }}
Ordinal number (ex. first, second, 10th, 21st, 22nd)
{{ ordinal_number(variablename) }}
By default, first-ninth will be written out. If you prefer them all as numbers, use:
{{ ordinal_number(variablename, use_word=False) }}
Turn number into a word (ex. One Hundred Thousand) (we recommend using the Integer question type for this)
{{ numbers_to_words(variablename) }}
EU Number Formatting (ex. 1.000.000,00 instead of 1,000,000.00)
{{ format_number_eu(variablename) }}
Canadian French Number Formatting (ex. 1 000 000,00$ instead of $1,000,000.00)
{{ "{:,.2f} $".format(variablename).replace(",", " ").replace(".", ",") }}