For a list of functions available to use in custom columns and a general introduction, see Functions in custom columns .
When constructing templates-related custom column formulas, there are context-sensitive sub-menu options on the Functionsmenu. Hover your input device over an option to display additional information. Within the formula text, right-click to view a menu of functions that are valid for the current context.
Standard custom column functions in templates
These options may include the following:
- Logic— Options for standard logic functions such as
if,and,not,or,if_error,is_error, andis_not_finite. - Text— Options for text functions such as
concat,is_empty,trim,starts_with,ends_with,search,substitute,right,left,contains,upper,lower,length,clean_keyword,string_len_byte,regex_extract,regex_match,regex_replace,search_byte,bmm,reduce_word,title_case,unescape, andsubstitute_all. - Arithmetic— Options for arithmetic functions such as
round,ceiling, andfloor. - Conversion— Options for conversion functions such as
to_text,to_number, andextract_percentage. - Date— Options for date functions such as
date,day,month,quarter,year,weekday,weeknum,daynum,days_between,offset_days,offset_months,offset_years,today,yesterday,week_start_sunday,week_start_monday,month_start, andyear_startare described in Functions in custom columns . - Aggregation— Options for aggregation functions such as
min,max, andany.
Template custom column functions
There is a range of custom column functions specifically available in the context of templates. These functions are described in the following table.
Notes
- These functions can be used in the Templates feature.
- Where the word "value" is shown in quotation marks, a text value is required.
- The terms needle, needles, and haystack are used in some functions in the following table. A "needle" or "needles" denotes a specific value or values that may be found within a series of values, the “haystack”.
| Sub-menu | Return type | Automation function expression | Description |
|---|---|---|---|
|
Logic
|
Boolean or number | is_not_finite(value, alternate)
|
Evaluates value
. If value
is not a number or a finite number, the function evaluates alternate
. Otherwise, the function returns value
. |
| |
Boolean, number, or text | if_error(value, error_value)
|
value
. If value
returns an error, the function evaluates the alternative defined in error_value
. Otherwise, the function returns the value
. |
| |
Boolean, number, or text | is_error(value)
|
Evaluates to true if value
is an error. |
|
Text
|
Text | clean_keyword("text", "replacement")
|
Scans the string and replaces characters that the advertising platform does not support for keyword text
with the replacement
text value. |
| |
Number | string_len_byte("value")
|
Returns the number of bytes in a feed attribute or text value. |
| |
Text | regex_extract("value", "regular_expression")
|
Searches a value
and returns text that matches a regular_expression
. |
| |
Boolean | regex_match("value", "regular_expression")
|
Evaluates as true if value
matches all or part of a regular_expression
. Use this function as a condition in the if
function. |
| |
Text | regex_replace("value", "regular_expression", "replacement")
|
Searches a value
for text that matches a regular_expression
, then replaces the matching text with replacement
. |
| |
Number or null | search_byte("needle", "haystack")
|
Returns the starting position in bytes of the first instance of needle in haystack. Returns null if needle is not in haystack. Counting starts from 1 (not 0). Always counts in the natural direction of the advertiser’s locale. Intended mainly for languages that do not use a Latin character set, such as Japanese and Chinese. |
| |
Text | reduce_word("value", length, "delimiter")
|
Returns as many characters as possible, starting from the beginning of a string and counting up to (but not including) a delimiter, while staying within max_length
. If the value
is already within max_length
, the function returns value
exactly as it was passed in. |
| |
Text | title_case("value")
|
Converts value
to title case. You can specify a feed attribute or a static text value. |
| |
Text | unescape("value")
|
Decodes a URL that has been URL encoded. |
| |
Text | substitute_all("haystack", replacement, "needles")
|
Replaces multiple values of an attribute with a single value. |
|
Conversion
|
Number | extract_percent("x%")
|
Converts a ratio, number, or text value to a percent. |
|
Aggregation
|
Boolean, number, or text | max(value)
|
Returns the maximum value
of a numeric feed attribute among the items selected by a template. |
| |
Boolean, number , or text | min(value)
|
Returns the minimum value
of a numeric feed attribute among the items selected by a template. |
| |
Boolean, number , or text | any(value)
|
Chooses a value
for an attribute from one of the items selected by a template. This function may output a different value
each time it runs. |
Use functions in feed and template custom columns
To use functions in feed and template custom columns, do the following:
- Select functions from the
menu. When you hover your input device over a function in the menu, details about the function are displayed.
- Select a function to include in the formula. The function’s formatted text is displayed with black placeholder elements.
- Replace the placeholder elements with information specific to your use case. For examples, see If logic function and Concat text function .
Do not edit green
text. It is a required part of the function.
When creating templates, the new Search Ads 360 shows only the functions that are valid for the current context.
If logic function
if(condition, if_true, if_false)
This is a logic function that evaluates a defined condition as true or false, then outputs the values you specify in if_true
and if_false
depending on whether the condition is found to be true or false.
- Edit
conditionto define the criteria to be evaluated. - Edit
if_trueto define what occurs when the condition is true. - Edit
if_falseto define what occurs when the condition is false.
Concat text function
concat("text1", "text2")
This is a text function that merges the content of two or more values. To add additional values, insert a comma followed by the additional value. Values must be text but can be derived from other functions. The function text_to
converts column values to text.
concat("Origin ", f:"origin_name")," Destination ", f:"destination_country", f:"destination_name"," - ", text_to(f:"price_usd"))
Address function value errors
The new Search Ads 360 doesn't generate campaigns, ads, and other items if functions return empty or invalid values. To address errors, consider using the following options to troubleshoot:
- Wrap functions in
if_error(parameter, alternate)
The parameter can be one of the following: function, feed column, text, or a combination of these types. If the function returns an error or is empty,alternateis returned instead.
Example:if_error(f:"brand", "Unbranded")
Result: Returnsf:"brand"if it has a value,"Unbranded"if it doesn't.
Usually, if a parameter is invalid, the whole function is invalid.
Example:if(f:"product_type" = "shoes", 1, 2)
When a feed item doesn't haveproduct_type, the whole if expression is invalid. Wrap theif_errorfunction around theiffunction:
Example :if_error(if(f:"product_type" = "shoes", 1, 2), 3)
Result: The function returns "3" ifproduct_typeisn’t defined in the feed item.
- Wrap functions in
is_error
Useif(is_error(parameter), alternate, value)
Parameters can include a feed column reference.f:"column_name"references a feed column.
When an error is returned, for example, if the feed column is empty,alternateis used. Otherwise,valueis used.
- Use aggregation
Usemin(value),max(value), orany(value)unless each ad group contains only one value for the attribute. Specifymax(f:"price_usd")if an ad group could contain products with different prices.
Address logic errors
To address logic errors, use the if(condition, true, false)
function to filter or change undesirable results. For example, use the if
function to shorten text that is too long.

