---
schema_version: "1"
id: 099ba2c6448f22d06b4dde7b49754db17e98ad7c18ddf08af7189c48bbe829f8
title: Sample Lead Management Formulas
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/useful_advanced_formulas_lead_mgmt.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.useful_advanced_formulas_lead_mgmt.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 2d9ff720aba750bbb2bce62ef4f98724355c694a6d819c0da0afdc93295e1742
description: Track how long leads have been open, measure lead data completeness, convert lead numbers for calculations, and distribute leads or cases across queues.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# Sample Lead Management Formulas

Track how long leads have been open, measure lead data completeness, convert lead numbers for calculations, and distribute leads or cases across queues.

### 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>Essentials</strong>, <strong>Group</strong>, <strong>Professional</strong>, <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

For details about using the functions included in these samples, see [Formula Operators and Functions](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.").

## Lead Aging (for open leads)

This formula checks to see if a lead is open and if so, calculates the number of days it has been open by subtracting the date and time created from the current date and time. The result is the number of days open rounded to zero decimal places. If the lead isn’t open, this field is blank.

```
IF(ISPICKVAL(Status,
                    "Open"), ROUND(NOW()-CreatedDate, 0), null)
```

## Lead Data Completeness

This formula calculates the percent of certain lead fields that your sales personnel enter. The formula field checks the values of two custom number fields: Phone and Email. If the fields are empty, the formula returns the value “0.” The formula returns a value of “1” for each field that contains a value and multiplies this total by fifty to give you the percentage of fields that contain data.

`(IF(Phone = "", 0, 1) + IF(Email = "", 0, 1) ) * 50`

## Lead Numbering

This formula returns a number value for the text value in the auto-number field Lead Number, which can be useful if you want to use the Lead Number field in a calculation, such as round-robin or other routing purposes. Auto-number fields are text fields and must be converted to a number for numeric calculations.

`VALUE(Lead_Number__c)`

## Round-Robin Assignment of Cases or Leads

The following formula example for leads assumes you have three lead queues and you want to assign an equal number of incoming leads to each queue. You can also assign cases using a similar formula.

```
MOD(VALUE(Lead_Number__c),
                  3)
```

This formula is for a custom formula field named Round\_Robin\_ID that assigns each lead a value of 0, 1, or 2. This formula uses a custom auto-number field called Lead Number that assigns each lead a unique number starting with 1. The MOD function divides the lead number by the number of lead queues available (three in this example) and returns a remainder of 0, 1, or 2. Use the value of this formula field in your lead assignment rules to assign lead records to different queues. For example:

- Round\_Robin\_ID = 0 is assigned to Queue A
- Round\_Robin\_ID = 1 is assigned to Queue B
- Round\_Robin\_ID = 2 is assigned to Queue C