1

I am trying to display two labels in each polygon and I want that show One label in Year 1 and show another line showing in 140,000 acres. I will use that in the Label Manager and use it in an expression.

I was able to write like this Math.round([Acres]) and it only shows 14000 but does not show the comma.

How do I insert an expression for the comma in an expression ?

1

From within your label manager or label panel in the ArcMap label properties, click the expression button.

Ensure the parser (at the bottom) is set to VBScript

In the upper-right hand corner of the expression box (that holds the expression itself), check the advanced box

You'll now have an expression that looks like this:

Function FindLabel ( [fieldName] )
  FindLabel = [fieldName]
End Function

Now simply add the FormatNumber option to your expression, wrapping your field name in parentheses:

Function FindLabel ( [fieldName] )
  FindLabel = FormatNumber([fieldName])
End Function

Now click the verify button to see how your number will look:

20,111,001.00

For more information, see this Microsoft article on the FormatNumber function: http://msdn.microsoft.com/en-us/library/xfta99yt%28v=vs.90%29.aspx

  • good stuff @PROBERT!!! – DPSSpatial Oct 21 '14 at 17:02
  • Exactly a lot of goodies stuff out there @mapBaker – PROBERT Oct 21 '14 at 17:04
  • @PROBERT don't forget to mark it as your answer if it works for ya... thanks! – DPSSpatial Oct 21 '14 at 17:16
1

Or the python equivalent for quick and simple , separator formatting would be something along the lines of

"{:,}".format(14000)

Obviously replacing the value with field name or rounding function and field name.

"{:,}".format(round([fieldname]))

Other potentially helpful python answers to this question https://stackoverflow.com/questions/1823058/how-to-print-number-with-commas-as-thousands-separators

Python documentation for formatting https://docs.python.org/2/library/string.html#format-specification-mini-language

0

In the Fields tab of the layer properties page, select your field, click in the Number Format section, click the ... ellipsis, and check Show thousands separators.

enter image description here

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.