Performing field calculations is an easy way to batch update many records at once in your table. The Field Calculator works on string, number, and date fields and automatically calculates selected records if the layer or table has a selection set present.
There are several tips for working with the field calculator which include the following:
- You can make calculations without being in an editing session; however, in that case, there is no way to undo the results.
- If you are working with the attribute table of a geodatabase feature class that participates in a geodatabase topology, geometric network, or a relationship class, the Field Calculator command is unavailable when you are not in an edit session.
- Use double quotes when calculating strings.
- When calculating a date field, any Python or VBScript datetime function can be used. Optionally, a number sign (#) can be used to denote a date in the same way that double quotation marks (") are used to denote a string. The number sign is not locale aware and can only work properly with U.S. English date structures. For other locales, use DateSerial() or another locale-specific function.
- A warning message will appear when performing a calculation on a text field if truncation occurs because the field length is too small to hold the calculated values. Truncated values are flagged with an asterisk so you can easily find and fix them if necessary.
- Start an edit session.
- Right-click the layer or table you want to edit and open its table.
- Right-click the field heading for which you want to make a calculation and click Field Calculator.
You can press CTRL+SHIFT+F as a shortcut to opening the Field Calculator.
- Use the Fields list and Functions to build a calculation expression. You can also edit the expression in the text area or type a value for the field.
If you do not see your all of your fields listed, check your field visibility settings. Any fields that have been turned off for the layer or table you are working with are not listed in the Field Calculator. Field visibility is set on the Fields tab of the Layer Properties or Table Properties dialog box or from the Table window.
- Click OK.