---
schema_version: "1"
id: cce99702029ce078766dac2cdb0861fc753d95dae1dfd70ea8215838f091de68
title: Sample Account Address Validation Rules
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/fields_useful_validation_formulas_account_address.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_account_address.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5b2fda31de884b2ea87ebf345604b784f510baae458ec5d18452c862efb28b91
description: Rules to maintain valid account addresses.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Sample Account Address Validation Rules

Rules to maintain valid account addresses.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Contact Manager</strong>, <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, <strong>Developer</strong>, and <strong>Database.com</strong> Editions</td></tr></tbody></table>

For more information on any of the formula functions used in these examples, see [Formula Operators and Functions by Context](https://help.salesforce.com/s/articleView?id=platform.customize_functions.htm&release=264.0.0&type=5 "Use these operators and functions when building formulas. All functions are available everywhere that you can include a formula, such as formula fields, validation rules, approval processes, and workflow rules, unless otherwise specified.").

## Canadian Billing Postal Code

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:28.999999999999996%">
          <col style="width:71%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e102">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e105">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e102 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e105 ">Validates that the account <samp class="parmname">Billing Zip/Postal Code</samp>
              is in the correct format if <samp class="parmname">Billing Country</samp> is
              Canada.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e102 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e105 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>AND(
OR(BillingCountry = "CAN", BillingCountry = "CA", BillingCountry = "Canada"),
NOT(REGEX(BillingPostalCode, "((?i)[ABCEGHJKLMNPRSTVXY]\\d[A-Z]?\\s?\\d[A-Z]\\d)?"))
)</code></pre>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e102 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e105 ">Canadian postal code must be in A9A 9A9 format.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e102 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e105 ">
              <strong class="uicontrol">Billing Zip/Postal Code</strong>
            </td>

          </tr>
        </tbody>
      </table>

## Billing Zip Code Is in Billing State

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:28.999999999999996%">
          <col style="width:71%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e193">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e196">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e193 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e196 ">Validates that the account <samp class="parmname">Billing Zip/Postal Code</samp>
              is valid by looking up the first five characters of the value in a custom
              object called Zip_Code__c that contains a record for every valid ZIP code in
              the US. If the ZIP code isn’t found in the Zip_Code__c object, or the
              <samp class="parmname">Billing State</samp> doesn’t match the corresponding
              State_Code__c in the Zip_Code__c object, an error is displayed.
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e193 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e196 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>VLOOKUP(
$ObjectType.Zip_Code__c.Fields.City__c ,
$ObjectType.Zip_Code__c.Fields.Name ,
LEFT(BillingPostalCode,5)) &lt;&gt; BillingCity</code></pre>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e193 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e196 ">Billing Zip Code doesn’t exist in specified Billing State.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e193 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e196 ">
              <strong class="uicontrol">Billing Zip/Postal Code</strong>
            </td>

          </tr>
        </tbody>
      </table>

## US Billing Zip Code

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:28.999999999999996%">
          <col style="width:71%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e284">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e287">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e284 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e287 ">Validates that the account <samp class="parmname">Billing Zip/Postal Code</samp>
              is in 99999 or 99999-9999 format if <samp class="parmname">Billing Country</samp> is
              USA or US.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e284 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e287 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>AND(
OR(BillingCountry = "USA", BillingCountry = "US"),
NOT(REGEX(BillingPostalCode, "\\d{5}(-\\d{4})?"))
)</code></pre>
              <p style="margin-bottom:0;">This example uses the <a href="https://help.salesforce.com/s/articleView?id=platform.customize_functions_regex.htm&amp;release=264.0.0&amp;type=5" title="Compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, returns FALSE.">REGEX</a> function; see <a href="https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_account_address.htm&amp;release=264.0.0&amp;type=5">Shipping Zip Code</a> if you aren’t
                familiar with regular expressions.</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e284 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e287 ">ZIP code must be in 99999 or 99999-9999 format.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e284 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e287 ">
              <strong class="uicontrol">Billing Zip/Postal Code</strong>
            </td>

          </tr>
        </tbody>
      </table>

## Shipping Zip Code

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:23%">
          <col style="width:77%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e390">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e393">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e390 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e393 ">Validates that the account <samp class="parmname">Shipping Zip/Postal Code</samp>
              is in 99999 or 99999-9999 format if <samp class="parmname">Shipping Country</samp> is
              USA or blank.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e390 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e393 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>AND(
 OR(ShippingCountry = "USA", ISBLANK(ShippingCountry)),
  OR(
   AND(LEN(ShippingPostalCode) &lt;&gt;5, 
      LEN(ShippingPostalCode) &lt;&gt; 10),
   NOT(CONTAINS("0123456789", 
      LEFT( ShippingPostalCode, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 2, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 3, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 4, 1))),
   NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 5, 1))),
   AND(
    LEN(ShippingPostalCode) = 10,
   OR(
    MID( ShippingPostalCode , 6, 1) &lt;&gt; "-",
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 7, 1))),
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 8, 1))),
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 9, 1))),
    NOT(CONTAINS("0123456789", 
      MID( ShippingPostalCode , 10, 1)))
   )
  )
 )
)
</code></pre>
              <p id="fields_useful_validation_formulas_account_address__USOnly"><a name="fields_useful_validation_formulas_account_address__USOnly"><!-- --></a>This example interprets a blank country as the US. To use
                this example with other countries, remove the clause that checks the
                length of the country field. Also, validation rule criteria are
                case-sensitive, so this rule is only enforced when the country is blank
                or “USA” in all capital letters. The rule isn’t enforced
                when the country is “usa.”</p>
              <p style="margin-bottom:0;" id="fields_useful_validation_formulas_account_address__SendToRegex"><a name="fields_useful_validation_formulas_account_address__SendToRegex"><!-- --></a>You can also validate ZIP codes using a regular
                expression; for an example of a formula using a regular expression, see
                <a href="https://help.salesforce.com/s/articleView?id=platform.customize_functions_regex.htm&amp;release=264.0.0&amp;type=5" title="Compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, returns FALSE.">REGEX</a>.
              </p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e390 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e393 ">ZIP code must be in 99999 or 99999-9999 format.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e390 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e393 ">
              <strong class="uicontrol">Shipping Zip/Postal Code</strong>
            </td>

          </tr>
        </tbody>
      </table>

## Valid Billing State (US)

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:30%">
          <col style="width:70%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e494">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e497">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e494 ">
              <span id="fields_useful_validation_formulas_account_address__Description"><a name="fields_useful_validation_formulas_account_address__Description"><!-- --></a>
                <strong>Description:</strong>
              </span>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e497 ">Validates that the account <samp class="parmname">Billing State/Province</samp>
              is a valid two-character abbreviation if <samp class="parmname">Billing
                Country</samp> is US, USA, or blank.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e494 ">
              <span id="fields_useful_validation_formulas_account_address__Formula"><a name="fields_useful_validation_formulas_account_address__Formula"><!-- --></a>
                <strong>Formula:</strong>
              </span>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e497 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>AND (
OR(BillingCountry = "US", BillingCountry="USA", ISBLANK(BillingCountry)),
OR(
LEN(BillingState) &lt; 2,
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &amp;
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &amp;
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &amp;
"WA:WV:WI:WY", BillingState)
)))</code></pre>
              <p style="margin-bottom:0;">This example interprets a blank country as the US. To use this example
                with other countries, remove the clause that checks the length of the
                country field. Also, validation rule criteria are case-sensitive, so this
                rule is only enforced when the country is blank or “USA” in
                all capital letters. The rule isn’t enforced when the country is
                “usa.”</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e494 ">
              <span id="fields_useful_validation_formulas_account_address__Error"><a name="fields_useful_validation_formulas_account_address__Error"><!-- --></a>
                <strong>Error Message:</strong>
              </span>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e497 ">A valid two-letter state code is required.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e494 ">
              <span id="fields_useful_validation_formulas_account_address__Location"><a name="fields_useful_validation_formulas_account_address__Location"><!-- --></a>
                <strong>Error Location:</strong>
              </span>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e497 ">
              <samp class="parmname">Billing State/Province</samp>
            </td>

          </tr>
        </tbody>
      </table>

## Valid Billing Province (Canada)

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:18.5%">
          <col style="width:81.5%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e600">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e603">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e600 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e603 ">Validates that the account <samp class="parmname">Billing State/Province</samp>
              is a valid two-character abbreviation if <samp class="parmname">Billing
                Country</samp> is CA or CAN.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e600 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e603 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>AND (
   OR(BillingCountry = "CA", BillingCountry="CAN"),
   OR(
   LEN(BillingState) &lt; 2,
   NOT(
      CONTAINS("AB:BC:MB:NB:NL:NT:NS:NU:ON:PC:QC:SK:YT", BillingState)
)))
</code></pre>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e600 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e603 ">A valid two-letter province code is required.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e600 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e603 ">
              <samp class="parmname">Billing State/Province</samp>
            </td>

          </tr>
        </tbody>
      </table>

## Valid Shipping State

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:18.5%">
          <col style="width:81.5%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e691">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e694">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e691 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e694 ">Validates that the account <samp class="parmname">Shipping State/Province</samp>
              is a valid two-character abbreviation if <samp class="parmname">Shipping
                Country</samp> is US, USA, or blank. </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e691 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e694 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>AND (
OR(ShippingCountry = "US", ShippingCountry="USA", ISBLANK(ShippingCountry)),
OR(
LEN(ShippingState) &lt; 2,
NOT(
CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" &amp;
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" &amp;
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" &amp;
"WA:WV:WI:WY", ShippingState)
)))</code></pre>
              <p style="margin-bottom:0;">This example interprets a blank country as the US. To use this example
                with other countries, remove the clause that checks the length of the
                country field. Also, validation rule criteria are case-sensitive, so this
                rule is only enforced when the country is blank or “USA” in
                all capital letters. The rule isn’t enforced when the country is
                “usa.”</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e691 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e694 ">A valid two-letter state abbreviation is required.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e691 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e694 ">
              <samp class="parmname">Shipping State/Province</samp>
            </td>

          </tr>
        </tbody>
      </table>

## Valid Shipping Province (Canada)

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:18.5%">
          <col style="width:81.5%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e785">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e788">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e785 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e788 ">Validates that the account <samp class="parmname">Shipping State/Province</samp>
              is a valid two-character abbreviation, if <samp class="parmname">Billing
                Country</samp> is CA or CAN.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e785 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e788 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>AND (
OR(ShippingCountry = "CA", ShippingCountry="CAN"),
OR(
LEN(ShippingState) &lt; 2,
NOT(
CONTAINS("AB:BC:MB:NB:NL:NT:NS:NU:ON:PC:QC:SK:YT", ShippingState)
)))</code></pre>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e785 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e788 ">A valid two-letter province abbreviation is required.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e785 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e788 ">
              <samp class="parmname">Shipping State/Province</samp>
            </td>

          </tr>
        </tbody>
      </table>

## Valid Billing Country

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:18.5%">
          <col style="width:81.5%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e876">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d83164e879">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e876 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e879 ">Validates that the account <samp class="parmname">Billing Country</samp> is a
              valid ISO 3166 two-letter code.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e876 ">
              <strong>Formula:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e879 ">
              <pre class="line-numbers slds-box slds-box_x-small slds-theme_shade slds-m-top_medium slds-m-bottom_medium slds-scrollable_x"><code>OR(
LEN(BillingCountry) = 1,
NOT(
CONTAINS(
"AF:AX:AL:DZ:AS:AD:AO:AI:AQ:AG:AR:AM:" &amp;
"AW:AU:AZ:BS:BH:BD:BB:BY:BE:BZ:BJ:BM:BT:BO:" &amp;
"BA:BW:BV:BR:IO:BN:BG:BF:BI:KH:CM:CA:CV:KY:" &amp;
"CF:TD:CL:CN:CX:CC:CO:KM:CG:CD:CK:CR:CI:HR:" &amp;
"CU:CY:CZ:DK:DJ:DM:DO:EC:EG:SV:GQ:ER:EE:ET:FK:" &amp;
"FO:FJ:FI:FR:GF:PF:TF:GA:GM:GE:DE:GH:GI:GR:GL:" &amp;
"GD:GP:GU:GT:GG:GN:GW:GY:HT:HM:VA:HN:HK:HU:" &amp;
"IS:IN:ID:IR:IQ:IE:IM:IL:IT:JM:JP:JE:JO:KZ:KE:KI:" &amp;
"KP:KR:KW:KG:LA:LV:LB:LS:LR:LY:LI:LT:LU:MO:MK:" &amp;
"MG:MW:MY:MV:ML:MT:MH:MQ:MR:MU:YT:MX:FM:MD:MC:" &amp;
"MC:MN:ME:MS:MA:MZ:MM:MA:NR:NP:NL:AN:NC:NZ:NI:" &amp;
"NE:NG:NU:NF:MP:NO:OM:PK:PW:PS:PA:PG:PY:PE:PH:" &amp;
"PN:PL:PT:PR:QA:RE:RO:RU:RW:SH:KN:LC:PM:VC:WS:" &amp;
"SM:ST:SA:SN:RS:SC:SL:SG:SK:SI:SB:SO:ZA:GS:ES:" &amp;
"LK:SD:SR:SJ:SZ:SE:CH:SY:TW:TJ:TZ:TH:TL:TG:TK:" &amp;
"TO:TT:TN:TR:TM:TC:TV:UG:UA:AE:GB:US:UM:UY:UZ:" &amp;
"VU:VE:VN:VG:VI:WF:EH:YE:ZM:ZW",
BillingCountry)))</code></pre>
            </td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e876 ">
              <strong>Error Message:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e879 ">A valid two-letter country code is required.</td>

          </tr>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e876 ">
              <strong>Error Location:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d83164e879 ">
              <samp class="parmname">Billing Country</samp>
            </td>

          </tr>
        </tbody>
      </table>