HOW TO
When formatting a number field to display as currency, only the value displays in the Table view.
To use currency formatting for analysis, annotations, and so forth, the values must be formatted in a text field. The instructions provide a sample code to convert a number field to a text field with currency formatting. For example, '1500000.30' converts to '$1,500,000.30'.
Code:
'$' + '{:,}'.format( !Currency_Field! )
Note:
Make sure to change !Currency_Field! to the name of the field that has the currency values.
Code:
def currency(x):
val = round(x,2)
out = '$' + '{:,}'.format(val)
right = len(out.split('.')[1])
if right < 2:
return out + '0'
else:
return out
Code:
currency( !Currency_Field! )
Article ID: 000012384
Get help from ArcGIS experts
Download the Esri Support App