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-generated output. Always test formulas in a sandbox and confirm field API names before deploying to production.
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.
IF(test, if_true, if_false)Returns one value when a condition is true, another when false.
CASE(expr, v1, r1, …, else)Multi-branch switch - cleaner than deeply nested IFs.
AND(a, b, …)AND is true only if every argument is true; OR if any is true.
NOT(logical)Reverses a boolean expression.
ISBLANK(expr)True when a field has no value. Preferred over ISNULL for text.
ISNULL(expr)Legacy null check for numbers and dates. Use ISBLANK for text.
ISPICKVAL(picklist, "Value")True when a picklist equals a specific value.
ISCHANGED(field)True when a field changed. Validation rules and workflow only.
PRIORVALUE(field)The field's value before the current edit.
BLANKVALUE(expr, substitute)Returns the substitute when the expression is blank.
ISNEW()True while a record is being created. Rules only.
TEXT(value)Converts a number, date, or picklist to text.
VALUE("123")Converts a text string to a number.
LEN(text)Number of characters in a text value.
LEFT(text, n)First or last n characters of a string.
MID(text, start, n)Substring of length n starting at a position.
FIND(search, text)Position of a substring inside another string.
SUBSTITUTE(text, old, new)Replaces every occurrence of a substring.
CONTAINS(text, sub)True when text contains the substring.
BEGINS(text, prefix)True when text starts with the given prefix.
TRIM(text)Removes leading and trailing spaces.
UPPER(text)Converts a string to lower or upper case.
HYPERLINK(url, label)Renders a clickable link in a formula field.
TODAY()Returns today's date (date type).
NOW()Returns the current date and time.
DATE(year, month, day)Builds a date from its parts.
DATEVALUE(expr)Converts text or a datetime to a date.
MONTH(date)Extracts the day, month, or year from a date.
WEEKDAY(date)Day of week as 1-7 (Sunday to Saturday).
ADDMONTHS(date, n)Adds (or subtracts) months to a date.
ABS(number)Absolute (positive) value of a number.
ROUND(number, places)Rounds a number to the given decimals.
CEILING(number)Rounds up or down to the nearest integer.
MOD(number, divisor)Remainder of a division. Ideal for business-day math.
MAX(a, b, …)Largest or smallest of the supplied values.
REGEX(text, "pattern")True when text matches a regex. Great for validation rules.
$User.Id, $Profile.NameMerge fields for the running user and their profile.
$Organization.IdOrg-level merge fields available in formulas.
PARENTGROUPVAL(field, grouping)Summary value from a parent grouping in reports.
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 optimizes a formula - checking it for errors and correcting them before it shortens and cleans it up. 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.
Salesforce Formula FAQ
Yes, completely free and unlimited. Generate a formula from plain English, explain an existing formula, fix a broken one, or optimize a working one - all with no login.
Generate turns a plain-English requirement into a formula. Explain reads any formula back to you in plain English, part by part. Fix takes a broken formula (and optionally the Salesforce error) and returns a corrected version. Optimize first checks the formula for syntax or logic errors and corrects any it finds, then rewrites it to be shorter, cleaner, and more compile-efficient - so it works whether you paste a clean formula or a messy one.
Yes. Pick the context - Formula Field, Validation Rule, Default Value, or Flow Formula - and the tool writes for that context. For a validation rule it returns TRUE to block the save and even suggests the error message.
It uses standard Salesforce formula syntax and real functions, and it flags any placeholder field names to swap for your real API names. Salesforce formula fields are limited to 3,900 source characters, which the tool tracks live. Always test in a sandbox first.
Yes. Formulas are the easy part. When you need Flows, Apex triggers, rollups, or a full Agentforce build, our certified Salesforce architects do that daily - book a free 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