All free tools
Free AI Tool

Salesforce Formula Generator

A free Salesforce formula generator and 4-mode workbench: generate a formula from plain English, explain one you inherited, fix an error, or optimize a working formula - for formula fields, validation rules, default values, and Flow. Built for Salesforce admins and developers.

AI-powered, 4 modes Syntax-highlighted Function reference built in
or press ⌘/Ctrl + Enter

AI-generated output. Always test formulas in a sandbox and confirm field API names before deploying to production.

Reference

Salesforce formula function reference

The functions you reach for most, with syntax and a one-line explanation. Search by name or what you are trying to do.

IFLogical
IF(test, if_true, if_false)

Returns one value when a condition is true, another when false.

CASELogical
CASE(expr, v1, r1, …, else)

Multi-branch switch - cleaner than deeply nested IFs.

AND / ORLogical
AND(a, b, …)

AND is true only if every argument is true; OR if any is true.

NOTLogical
NOT(logical)

Reverses a boolean expression.

ISBLANKLogical
ISBLANK(expr)

True when a field has no value. Preferred over ISNULL for text.

ISNULLLogical
ISNULL(expr)

Legacy null check for numbers and dates. Use ISBLANK for text.

ISPICKVALLogical
ISPICKVAL(picklist, "Value")

True when a picklist equals a specific value.

ISCHANGEDLogical
ISCHANGED(field)

True when a field changed. Validation rules and workflow only.

PRIORVALUELogical
PRIORVALUE(field)

The field's value before the current edit.

BLANKVALUELogical
BLANKVALUE(expr, substitute)

Returns the substitute when the expression is blank.

ISNEWLogical
ISNEW()

True while a record is being created. Rules only.

TEXTText
TEXT(value)

Converts a number, date, or picklist to text.

VALUEText
VALUE("123")

Converts a text string to a number.

LENText
LEN(text)

Number of characters in a text value.

LEFT / RIGHTText
LEFT(text, n)

First or last n characters of a string.

MIDText
MID(text, start, n)

Substring of length n starting at a position.

FINDText
FIND(search, text)

Position of a substring inside another string.

SUBSTITUTEText
SUBSTITUTE(text, old, new)

Replaces every occurrence of a substring.

CONTAINSText
CONTAINS(text, sub)

True when text contains the substring.

BEGINSText
BEGINS(text, prefix)

True when text starts with the given prefix.

TRIMText
TRIM(text)

Removes leading and trailing spaces.

LOWER / UPPERText
UPPER(text)

Converts a string to lower or upper case.

HYPERLINKText
HYPERLINK(url, label)

Renders a clickable link in a formula field.

TODAYDate & Time
TODAY()

Returns today's date (date type).

NOWDate & Time
NOW()

Returns the current date and time.

DATEDate & Time
DATE(year, month, day)

Builds a date from its parts.

DATEVALUEDate & Time
DATEVALUE(expr)

Converts text or a datetime to a date.

DAY / MONTH / YEARDate & Time
MONTH(date)

Extracts the day, month, or year from a date.

WEEKDAYDate & Time
WEEKDAY(date)

Day of week as 1-7 (Sunday to Saturday).

ADDMONTHSDate & Time
ADDMONTHS(date, n)

Adds (or subtracts) months to a date.

ABSMath
ABS(number)

Absolute (positive) value of a number.

ROUNDMath
ROUND(number, places)

Rounds a number to the given decimals.

CEILING / FLOORMath
CEILING(number)

Rounds up or down to the nearest integer.

MODMath
MOD(number, divisor)

Remainder of a division. Ideal for business-day math.

MAX / MINMath
MAX(a, b, …)

Largest or smallest of the supplied values.

REGEXAdvanced
REGEX(text, "pattern")

True when text matches a regex. Great for validation rules.

$User / $ProfileAdvanced
$User.Id, $Profile.Name

Merge fields for the running user and their profile.

$OrganizationAdvanced
$Organization.Id

Org-level merge fields available in formulas.

PARENTGROUPVALAdvanced
PARENTGROUPVAL(field, grouping)

Summary value from a parent grouping in reports.

DISTANCEAdvanced
DISTANCE(geoA, geoB, "mi")

Distance between two geolocation fields.

A curated subset of the 40+ most-used functions. Salesforce has 70+ formula functions in total.

From plain English to production-ready formula

Salesforce formula syntax is powerful but unforgiving - nested IFs, CASE statements, null handling with BLANKVALUE, date math, and picklist checks with ISPICKVAL. This workbench does four things: writes a formula from your description, reads any formula back in plain English, fixes one that throws an error, and rewrites a working formula to be shorter and clearer. It knows the difference between a formula field, a validation rule that returns TRUE to block a save, a default value, and a Flow formula.

When the logic outgrows a formula field - cross-object rollups, Flows, or Apex triggers - that is where our certified Salesforce architects come in. See our implementation checklist or book a call.

FAQ

Salesforce Formula FAQ

Free 30-min call

Need more than a formula?

Validation rules, Flows, Apex, Agentforce - our certified Salesforce architects build it. Book a free call.

Book Free Discovery Call
Ask me anything