Field Calculating: need to display two decimal places

24366
4
Jump to solution
01-26-2015 07:37 AM
DaveMartin1
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?

Thanks much in advance,

Dave

0 Kudos
1 Solution

Accepted Solutions
XanderBakker
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:

FieldProperties.png

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

FieldPropertiesNumeric.png

View solution in original post

0 Kudos
4 Replies
Marco_AlejandroBonilla
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

0 Kudos
DaveMartin1
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"

0 Kudos
XanderBakker
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:

FieldProperties.png

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

FieldPropertiesNumeric.png

0 Kudos
DaveMartin1
New Contributor

That solves it Xander.  Thanks for your help!

Dave

0 Kudos