Salesforce Formulas & Functions Library: 100+ Examples for Admins and Developers

On this page, I have collected all my Salesforce formulas and functions tutorials in one place so that you can quickly find the exact example you need for your business requirement.

Whenever you get stuck on a formula, you don’t need to search all over the web. You can bookmark this Salesforce Formulas & Functions Library and use it as your personal reference to:

  • Copy ready‑to‑use Salesforce formula patterns.
  • Learn how individual Salesforce functions work, with syntax and examples.
  • Discover new ideas to simplify automation, validation rules, and reports.

I have organized the tutorials by category — dates, text, logical, numeric, picklists, cross‑object, reporting, and more — and at the end, you will also find a complete index of all my formula and function articles.

How I recommend you use this library

Here is how I suggest using this Salesforce formulas and functions hub:

  • If you are new to formulas, start with date formulas and logical functions.
  • If you are an Admin or Consultant, keep this page open while building validation rules, formula fields, and Flow expressions.
  • If you are a Developer or Architect, use it as a quick reference for function behavior and tricky edge cases.

You can scroll by section when you know the category (for example, date formulas), or jump to the full index at the end if you know the function name.

Salesforce Date Formulas and Date/Time Functions

Date formulas are the backbone of SLAs, due dates, renewals, and age calculations. I use these patterns in almost every project.

Start with a general overview of date formulas and date functions:

Frequently used Salesforce date formula patterns:

With these examples, you can handle most date‑related use cases like SLAs, follow‑up reminders, aging, and contract renewals.

Salesforce Text Formulas and String Functions

Text formulas help you clean data, format labels, generate URLs, and display user‑friendly messages.

Core Salesforce text functions:

Formatting helpers for better UX:

I use these patterns for things like:

  • Building dynamic links to records and reports.
  • Formatting addresses and labels.
  • Extracting parts of a string (for example, prefixes, codes, or domain names).

Salesforce Logical Functions (IF, AND, OR, ISBLANK, CASE, etc.)

Logical functions are the “brain” of your formulas. They control when rules fire and what values you show.

Key logical and control functions:

Null and value detection functions:

Record‑state helpers:

These are essential in:

  • Validation rules (for example, only enforce a rule when a field changes).
  • Formula fields that show different messages or values based on conditions.
  • Process builder and Flow formulas that decide which path to take.

Salesforce Numeric and Math Functions

Numeric functions are useful for scoring, calculations, thresholds, and anything involving numbers.

Key numeric functions:

I rely on these functions for:

  • Calculating scores, percentages, and thresholds.
  • Rounding and formatting numeric outputs.
  • Multi‑currency logic and duration calculations.

Picklist and Checkbox Formulas

Picklist and checkbox formulas are very common in real projects, especially when driving business logic or UI behavior.

These patterns are useful when:

  • You need to default a picklist based on other fields.
  • You want to control visibility or validation depending on a checkbox or picklist.
  • You want to count how many values are selected in a multi‑select picklist.

Cross‑object Salesforce Formulas and ID‑related Functions

Cross‑object formulas and ID handling often come up when you want to show parent data or work with IDs safely.

I use these when:

  • I need to show information from parent or related records without creating redundant fields.
  • I must convert 15‑character IDs to 18‑character IDs safely.
  • I want to “look up” values based on other fields inside a formula.

Geolocation Formulas and Distance Calculations

If you are working with territories, proximity, or location‑based routing, these geolocation functions are helpful.

You can use these to calculate distances between two locations and incorporate that into assignment or territory logic.

Salesforce Reporting Formulas (row‑level and report‑level)

You don’t always need a formula field on the object; sometimes a report‑level formula is enough.

Combine these with the date and text functions above to create powerful summaries and KPIs directly in reports.

Using formulas inside Salesforce Flow

Formulas are not only for fields and validation rules; you also use them heavily inside Flows.

If you are following my Flow tutorials, this article shows how to apply the same formula logic in Flow expressions, decisions, and assignments.

Advanced and Utility Salesforce Functions

Some functions don’t fit neatly into the categories above but are still very useful in specific scenarios.

I use these when I need to:

  • Validate complex text patterns (with REGEX).
  • Work with characters or capitalization in a special way.
  • Understand more advanced behavior when integrating with other tools.

Tableau Functions for Salesforce Professionals

If you are also working with Tableau on top of Salesforce data, these Tableau function tutorials will help:

These are especially useful if you are building analytics or dashboards that combine Salesforce and Tableau.

Full Index: All Salesforce Formula and Function Tutorials

Here is a complete index of all my Salesforce formula and function tutorials so far. If you know the name of a function or you are exploring ideas, you can scan this list quickly.

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.