HOW TO

Extract characters from a string field to a new field using a space as a delimiter

Last Published: November 16, 2021

Summary

Note: 
The information in this article applies to ArcGIS version 9.x only. Visual Basic for Applications (VBA) for ArcMap and ArcCatalog has been deprecated at ArcGIS 10.

Instructions provided describe how to extract characters from a string field to a new field using a space as a delimiter. This article contains a code sample that extracts all characters to the left of the first space and pastes them into another field.

Procedure

Follow the steps below:
  1. Click Editor on the Editor toolbar and click Start Editing.
  2. Right-click the layer or standalone table in the Table of Contents and click Open Attribute Table.
  3. Right-click the field heading for the field in which the extracted characters are stored. Click Calculate Values.
  4. Click on the Advanced checkbox.

    [O-image] Field Calculator
  5. Type the following VBA statement in the first text box:
    dim space as integer
    space = instr([name], " ")
    dim var as string
    var = left([name], space)

    Change [name] in lines 2 and 4 to the source field name.
  6. Type the variable varĀ in the text box directly under the area field name.
  7. Click OK.

Article ID:000008233

Software:
  • 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