HOW TO

Create stacked labels from text in the same field

Last Published: April 25, 2020

Summary

This document illustrates creating stacked labels based on a single field. For example, a field with both city name and state name, such as "Anchorage Alaska", will be labeled as follows:

City: Anchorage
State: Alaska

This method does not work well for values with more than one space. For example, "Los Angeles California" will be labeled as:

City: Los
State: Angeles California

For values that do not contain a space, it will not label the feature.

Procedure

  1. Right-click the layer in the ArcMap Table of Contents and select Properties.
  2. Switch to the Labels tab.
  3. Click the Expression button.
  4. Check on the Advanced check box.
  5. Replace the existing code with the following:
Function FindLabel ( [City_State] )
  Dim theString, LeftStr, RightStr, ThePos
  theString = [City_State]
  ThePos = Instr(theString, " ") - 1
  LeftStr = Left (theString, ThePos)
  RightStr = Right (theString, Len(thestring) - ThePos)
  FindLabel = "City: "&LeftStr&VBNewLine&"State: "&RightStr
End Function 
Note:
When using this code on your table, replace both occurrences of the City_State field name with the name of the field in your table.
  1. Click OK.
  2. Check the Label Features in this layer check box.
  3. in the Layer Properties dialog box, click Apply and click OK.

Article ID:000005022

Software:
  • ArcMap 8 x
  • ArcMap 9 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic