Select to view content in your preferred language

# Field Calculating: need to display two decimal places

25529
4
01-26-2015 07:37 AM
New Contributor

I'm attempting to calculate a field to show acres, displayed to 2 decimal places.

I've got field A  representing area in sq. ft..  I've created a new field  B to represent area in acres (to 2 decimal places).

When I created field B (for acres) I specified precision of 2.  I've attempted both short and long integers for field type.  In Field Calculator (for field B) I enter the phrase  "A/43560'  It calculates the field alright.  Problem is, it's returning the answer, but it's rounding to the nearest whole number.  (any acreage below 0.5 is displaying as 0)

How do I make it display Acres to two decimal places?

Dave

1 Solution

Accepted Solutions
Esri Esteemed Contributor

When creating the field the field scale sets the number of decimal places stored in a field. This parameter is only used in Float and Double data field types.

... but:  If the input table is a personal or file geodatabase the field scale value will be ignored.

You can change the display properties of a field. In the attribute table, right click on the field header (the name) and select "properties". Next click on the button next to Numeric:

In the numeric format dialog, change the number of decimals:

4 Replies
Occasional Contributor

If you need a 2 decimal visualization only, you can set that in the "Field Properties". There, inside the Numeric properties set the decimal places to 2. and you get the field. Also, if you need the value itself set to 2, you can use field calculator in your new field with this code Round("Field1",2).

Finally, remember that for decimal places you need a "Double" or "Float" data type. Not an "integer" type

New Contributor

Marco,

Thanks for your input.  I typed the following

Round("Area_Acres",2)

in the Field Calculator, but I get error message

"Error running VBA code: Expected identifier"

Esri Esteemed Contributor

When creating the field the field scale sets the number of decimal places stored in a field. This parameter is only used in Float and Double data field types.

... but:  If the input table is a personal or file geodatabase the field scale value will be ignored.

You can change the display properties of a field. In the attribute table, right click on the field header (the name) and select "properties". Next click on the button next to Numeric:

In the numeric format dialog, change the number of decimals:

New Contributor

That solves it Xander.  Thanks for your help!

Dave