---
schema_version: "1"
id: 3d4c36333304c47d6d3617bd1cdb2b0653b100ac32be2e8e7dc8fe5b7a4887f2
title: Sample Account 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.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.fields_useful_validation_formulas_account.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 10dcef3faf9f80ca9e557609fbc4651b29a4a86d80232cda6ece90a7fb64d50e
description: Validation rule examples for numeric account numbers, account number length, and annual revenue range.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Sample Account Validation Rules

Validation rule examples for numeric account numbers, account number length, and annual revenue range.

### 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.").

## Account Number Is Numeric

<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="d192933e102">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d192933e105">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e102 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e105 ">Validates that the <samp class="parmname">Account Number</samp> is numeric if not
              blank.</td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e105 ">
              <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(
   ISBLANK(AccountNumber),
   NOT(ISNUMBER(AccountNumber))
)</code></pre>
            </td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e105 ">Account Number is not numeric.</td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e105 ">
              <samp class="parmname">Account Number</samp>
            </td>

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

## Account Number Length

<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="d192933e190">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d192933e193">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e190 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e193 ">Validates that the <samp class="parmname">Account Number</samp> is exactly seven
              digits (if it is not blank). The number seven is simply illustrative. You
              can change this to any number you like.</td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e193 ">
              <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(
   ISBLANK(AccountNumber),
   LEN(AccountNumber) &lt;&gt; 7
)
</code></pre>
            </td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e193 ">Account Number must be seven digits.</td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e193 ">
              <samp class="parmname">Account Number</samp>
            </td>

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

## Annual Revenue Range

<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="d192933e278">Field</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d192933e281">Value</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Field" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e278 ">
              <strong>Description:</strong>
            </td>

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e281 ">Validates that the account <samp class="parmname">Annual Revenue</samp> is not
              negative and does not exceed $100 billion. This limit is designed to catch
              typos.</td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e281 ">
              <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(
   AnnualRevenue &lt; 0,
   AnnualRevenue &gt; 100000000000
)
</code></pre>
            </td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e281 ">Annual Revenue cannot exceed 100 billion.</td>

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

            <td data-label="Value" class="slds-cell-wrap" style="vertical-align:top;" headers="d192933e281 ">
              <samp class="parmname">Annual Revenue</samp>
            </td>

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