Knowledge Base - Technical Articles

Technical Article   HowTo:  Capitalize the first letter of a text or string field

Article ID: 30776
Software:  ArcGIS - ArcEditor 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcInfo 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1 ArcGIS - ArcView 8.3, 9.0, 9.1, 9.2, 9.3, 9.3.1
Platforms:  Windows 2000, XP


Instructions provided describe how to use the Field Calculator in ArcMap to capitalize the first letter of all the values of a text or string field in the Attribute Table.


Follow the steps below.
 The procedure described below is for Version 9.3x and earlier.

  1. In ArcMap, open the Attribute Table of a layer.
  2. Right-click on a field heading of a text field > Calculate Values ...

     Optionally, create a new text field for the result by first clicking Options > Add Field.

  3. Click, when the Field Calculator appears, the Advanced checkbox.
  4. Paste the following code in the Pre Logic VBA Script Code box.

    Dim sUpperC As String
    sUpperC = LEFT( [FIELD_NAME], 1)

    Dim sLowerC As String
    sLowerC = RIGHT( [FIELD_NAME], LEN( [FIELD_NAME]) - 1)

    Dim Output As String
    Output = UCASE(sUpperC) & sLowerC

  5. Change [FIELD_NAME] to the actual name of the field in which you want to capitalize the first letter.
  6. Type the word 'Output' in the box below the code.
  7. Click OK.

Created: 5/5/2006
Last Modified: 8/29/2012

Article Rating: (2)
If you would like to post a comment, please login


By loch_kalyan16 - 07/17/2012 2:58 AM

Other - See details below.

I still can't get the 1st capital letter as following that method.


By Anonymous - 12/08/2008 4:20 PM

I would like to see a new article that discusses the topic outlined below.

The solution only capitalizes the first letter of a string. But a solution that capitalizes the first letter of each word would be really really useful - especially for place names e.g. New York, United States of America, Coney Island, Fort Apache, etc. Thanks, Marty

By Anonymous - 12/08/2008 4:09 PM

The article needs to be updated.

The solution does not work if the FIELD already contains all UPPERCASE letters, and the user wants to convert them to Capitalised case. To make this work correctly no matter what the original case, replace this line of code: sLowerC = RIGHT( [FIELD_NAME], LEN( [FIELD_NAME]) - 1) with this line of code that applies the LCase function: sLowerC = LCase(RIGHT( [FIELD_NAME], LEN( [FIELD_NAME]) - 1)) Thanks, Marty :)