Formatting a numeric field- round to 10s or 100s

1843
3
08-13-2019 03:30 PM
AaronWorthley1
Frequent Contributor

When formatting a numeric field in a table, rounding to decimal places or significant numbers is straightforward- but how do I round to the nearest 10 or 100 (ie to the left of the decimal)? My numbers range from 41 the over 1,000,000 and I'd like them all to display as x,xxx,xx0. I've played around with all the numeric options and custom formatting, but can't find a way- is it possible?

0 Kudos
3 Replies
JoeBorgione
MVP Emeritus

The round() function in python can do it for you:

numList = [41, 63, 47, 116, 1000055]
for n in numList:
    print(round(n,-1))

#returns:

40
60
50
120
1000060‍‍‍‍‍‍‍‍‍‍‍

In a field calculator it looks like:

That should just about do it....
AaronWorthley1
Frequent Contributor

Right, but I'm not trying to calculate a new or existing field, rather just formatting an existing field using the numeric formatting dialog. In a python expression, you use a negative number to round left of the decimal, but the numeric field formatting dialog won't accept negative numbers in the rounding>decimal places entry.

I'm hoping to format an auto-calculated geodatabase area field for use in a layout table frame. I don't want to have to recalculate the field (and rebuild the table frame) every time the underlying geometry changes.

0 Kudos
DanPatterson_Retired
MVP Emeritus

It requires a new field, there is no way to display rounding in the table beyond rounding to 0 decimal places.

Scientific notation won't help much, it would look just as ugly in the report table