You are here:
All Formula Operators and Functions
Use 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.
- + (Add)
Calculates the sum of two values. - - (Subtract)
Calculates the difference of two values. - * (Multiply)
Multiplies its values. - / (Divide)
Divides its values. - ^ (Exponentiation)
Raises a number to a power of a specified number. - () (Open Parenthesis and Close Parenthesis)
Specifies that the expressions within the open parenthesis and close parenthesis are evaluated first. All other expressions are evaluated using standard operator precedence. - = and == (Equal)
Evaluates if two values are equivalent. The = and == operators are interchangeable. - <> and != (Not Equal)
Evaluates if two values aren’t equivalent. - < (Less Than)
Evaluates if a value is less than the value that follows this symbol. - > (Greater Than)
Evaluates if a value is greater than the value that follows this symbol. - <= (Less Than or Equal)
Evaluates if a value is less than or equal to the value that follows this symbol. - >= (Greater Than or Equal)
Evaluates if a value is greater than or equal to the value that follows this symbol. - && (AND)
Evaluates if two values or expressions are both true. Use this operator as an alternative to the logical function AND. - || (OR)
Evaluates if at least one of multiple values or expressions is true. Use this operator as an alternative to the logical function OR. - & and + (Concatenate)
Connects two or more strings. - ABS
Calculates the absolute value of a number. The absolute value of a number is the number without its positive or negative sign. - ADDMONTHS
Returns the date that is the indicated number of months before or after a specified date. If the specified date is the last day of the month, the resulting date is the last day of the resulting month. Otherwise, the result has the same date component as the specified date. - AND
Returns a TRUE response if all values are true; returns a FALSE response if one or more values are false. - BEGINS
Determines if text begins with specific characters and returns TRUE if it does. Returns FALSE if it doesn't. - BLANKVALUE
Determines if an expression has a value and returns a substitute expression if it doesn’t. If the expression has a value, returns the value of the expression. - BR
Inserts a line break in a string of text. - CASE
Checks a given expression against a series of values. If the expression is equal to a value, returns the corresponding result. If it isn't equal to any of the values, returns theelse_result. - CASESAFEID
Converts a 15-character ID to a case-insensitive 18-character ID. In Salesforce Classic, the function converts only valid Salesforce 15-character IDs. If you pass in an invalid ID, the function returns the ID passed in. In Lightning Experience, the function converts any 15-character ID. - CEILING
Rounds a number up to the nearest integer, away from zero if negative. - CONTAINS
Compares two arguments of text and returns TRUE if the first argument contains the second argument. If not, returns FALSE. - CURRENCYRATE
Returns the conversion rate to the corporate currency for the given currency ISO code. If the currency is invalid, returns 1.0. - DATE
Returns a date value from the year, month, and day values you enter. Salesforce displays an error on the detail page if the value of the DATE function in a formula field is an invalid date, such as February 29 in a non-leap year. - DATEVALUE
Returns a date value for a date/time or text expression. - DATETIMEVALUE
Returns a year, month, day, and GMT time value. - DAY
Returns a day of the month in the form of a number from 1 through 31. - DISTANCE
Calculates the distance between two locations in miles or kilometers. - EXP
Returns a value for e raised to the power of a number you specify. - FIND
Returns the position of a string within a string of text represented as a number. - FLOOR
Returns a number rounded down to the nearest integer, towards zero if negative. - GEOLOCATION
Returns a geolocation based on the provided latitude and longitude. Must be used with the DISTANCE function. - GETRECORDIDS
Returns an array of strings in the form of record IDs for the selected records in a list, such as a list view or related list. - GETSESSIONID
Returns the user’s session ID. - HOUR
Returns the local time hour value without the date in the form of a number from 1 through 24. - HTMLENCODE
Encodes text and merge field values for use in HTML by replacing characters that are reserved in HTML, such as the greater-than sign (>), with HTML entity equivalents, such as>. - HYPERLINK
Creates a link to a URL specified that is linkable from the text specified. - IF
Determines if expressions are true or false. Returns a given value if true and another value if false. - IMAGE
Inserts an image with alternate text and height and width specifications. - IMAGEPROXYURL
Securely retrieves external images and prevents unauthorized requests for user credentials. - INCLUDE
Returns content from an s-control snippet. Use this function to reuse common code in many s-controls. - INCLUDES
Determines if any value selected in a multi-select picklist field equals a text literal you specify. - ISBLANK
Determines if an expression has a value and returns TRUE if it does not. If it contains a value, this function returns FALSE. - ISCHANGED
Compares the value of a field to the previous value and returns TRUE if the values are different. If the values are the same, this function returns FALSE. - ISCLONE
Checks if the record is a clone of another record and returns TRUE if one item is a clone. Otherwise, returns FALSE. - ISNEW
Checks if the formula is running during the creation of a new record and returns TRUE if it is. If an existing record is being updated, this function returns FALSE. - ISNULL
Determines if an expression is null (blank) and returns TRUE if it is. If it contains a value, this function returns FALSE. - ISNUMBER
Determines if a text value is a number and returns TRUE if it is. Otherwise, returns FALSE. - ISPICKVAL
Determines if the value of a picklist field is equal to a text literal you specify. - JSENCODE
Encodes text and merge field values for use in JavaScript by inserting escape characters, such as a backslash (\), before unsafe JavaScript characters, such as the apostrophe ('). - JSINHTMLENCODE
Encodes text and merge field values for use in JavaScript inside HTML tags by replacing characters that are reserved in HTML with HTML entity equivalents and inserting escape characters before unsafe JavaScript characters. - JUNCTIONIDLIST
Returns a JunctionIDList based on the provided IDs. - LEFT
Returns the specified number of characters from the beginning of a text string. - LEN
Returns the number of characters in a specified text string. - LINKTO
Returns a relative URL in the form of a link (href and anchor tags) for a custom s-control or Salesforce page. - LN
Returns the natural logarithm of a specified number. Natural logarithms are based on the constant e value of 2.71828182845904. - LOG
Returns the base 10 logarithm of a number. - LOWER
Converts all letters in the specified text string to lowercase. Any characters that are not letters are unaffected by this function. Locale rules are applied if a locale is provided. - LPAD
Inserts characters you specify to the left-side of a text string. - MAX
Returns the highest number from a list of numbers. - MCEILING
Rounds a number up to the nearest integer, towards zero if negative. - MFLOOR
Rounds a number down to the nearest integer, away from zero if negative. - MID
Returns the specified number of characters from the middle of a text string given the starting position. - MILLISECOND
Returns a milliseconds value in the form of a number from 0 through 999. - MIN
Returns the lowest number from a list of numbers. - MINUTE
Returns a minute value in the form of a number from 0 through 60. - MOD
Returns a remainder after a number is divided by a specified divisor. - MONTH
Returns the month, a number from 1 (January) through 12 (December) in number format of a given date. - NOT
Returns FALSE for TRUE and TRUE for FALSE. - NOW
Returns a date/time representing the current moment. - NULLVALUE
Determines if an expression is null (blank) and returns a substitute expression if it is. If the expression is not blank, returns value of the expression. - OR
Determines if expressions are true or false. Returns TRUE if any expression is true. Returns FALSE if all expressions are false. - PARENTGROUPVAL
This function returns the value of a specified parent grouping. A “parent” grouping is any level above the one containing the formula. - PREDICT
Returns an Einstein Discovery prediction for a record based on the specified record ID or for a list of fields and their values. - PREVGROUPVAL
This function returns the value of a specified previous grouping. A “previous” grouping is one that comes before the current grouping in the report. - PRIORVALUE
Returns the previous value of a field. - REGEX
Compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, returns FALSE. - REQUIRESCRIPT
Returns a script tag with URL source that you specify. Use this function when referencing the Lightning Platform AJAX Toolkit or other JavaScript toolkits. - REVERSE
Returns the characters of a source text string in reverse order. - RIGHT
Returns the specified number of characters from the end of a text string. - ROUND
Returns the nearest number to a number you specify, constraining the new number by a specified number of digits. - RPAD
Inserts characters that you specify to the right-side of a text string. - SECOND
Returns a seconds value in the form of a number from 0 through 60. - SQRT
Returns the positive square root of a given number. - SUBSTITUTE
Substitutes new text for old text in a text string. - TEXT
Converts a percent, number, date, date/time, or currency type field into text anywhere formulas are used. Also, converts picklist values to text in approval rules, approval step rules, workflow rules, escalation rules, assignment rules, auto-response rules, validation rules, formula fields, field updates, and custom buttons and links. - TIMENOW
Returns a time value in GMT representing the current moment. Use this function instead of the NOW function if you only want to track time, without a date. - TIMEVALUE
Returns the time value without the date, such as business hours. - TODAY
Returns the current date as a date data type. - TRIM
Removes the spaces and tabs from the beginning and end of a text string. - UPPER
Converts all letters in the specified text string to uppercase. - URLENCODE
Encodes text and merge field values for use in URLs by replacing characters that are illegal in URLs, such as blank spaces, with the code that represent those characters as defined in RFC 3986, Uniform Resource Identifier (URI): Generic Syntax. - URLFOR
Returns a URL for an action, an s-control, a Visualforce page, or a file in a static resource archive. URLFOR is available for use in custom buttons and links, s-controls, and Visualforce pages. - VALUE
Converts a text string to a number. - VLOOKUP
Returns a value by looking up a related value on a custom object similar to the VLOOKUP() Excel function. This function is only available in validation rules. - WEEKDAY
Returns the day of the week for the given date, using 1 for Sunday, 2 for Monday, through 7 for Saturday. - YEAR
Returns the four-digit year in number format of a given date.

