5

I have a benchmark data that need to label.

The data where in the field has attribute height like 12.340, 12.400, 13.690.

I have to label the height for examples 12.34, 12.40, 13.69.I already used vb script Round([ZOR],2).

However, for 12.34 and 13.69 it was okay but for 12.400 it just appear 12.4, i need to it appear 12.40.

So what should i do?

  • 2
    Create a text field in your FC to where you copy your values. There you can make sure you get exactly what you need. – Martin Sep 17 '15 at 9:13
  • Try formatnumber, usually works in VB vb-helper.com/howto_net_format_number.html – FelixIP Sep 17 '15 at 9:40
  • To format number labels for two decimals places: FormatNumber([ZOR], 2,,, 0) – Gwen Jul 12 '16 at 15:53
6

This can be done by changing the number format of the field. A side effect is that the display value changes everywhere, in the attribute table, the Identify dialog, etc. This may or may not be what you want.

  • Double click on the layer to open its Properties dialog
  • Select the Fields tab,
  • Select the field you want to change
  • Click on Number Format
  • Set Rounding to: Number of decimal places: 2
  • Check Pad with zeroes

Number format dialog

0

The way I found that works best is to use the VBScript expression FormatNumber.

This will only display the number to the designated number of decimal places and pad the label with zeros where appropriate.

For the example in the question use FormatNumber([ZOR],2)

This will address the question at hand with regards to labeling and does not relate to setting the Number Format for the field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.