English

How To: Stack labels from text in the same field

Summary

Instructions provided describe how to create stacked labels based on a single field. For example, a field with genus, species and subspecies information, is labeled as:

genus name
species name
subspecies name

Procedure

Sometimes all of the information for a label is contained in one long field. This information can be parsed out and stacked by using the Visual Basic Replace function in a labeling expression. For example; a field that is formatted:

genus name, species name, subspecies name

can be stacked:

genus name
species name
subspecies name

If there is a section of the field missing, for example, there is no subspecies name listed, the label expression only contains the two existing stacked lines.

  1. Click the Label Manager button on the Labeling toolbar.
  2. Check the box next to the layer to be labeled.
  3. Select a label class under the layer.
  4. Click the Expression button.
  5. Check on the Advanced check box.
  6. Replace the existing code with the following substituting your field name for the fieldname in the expression:

    Code:
    Function FindLabel ( [fieldname] )
    FindLabel = replace([fieldname], ", ", vbnewline)
    End Function

Related Information