If value is an error, evaluates and returns alternate. Otherwise, evaluates and returns value.
Syntax
if_error(value, alternate)
value and alternate can be an expression, any data type, or any Search Ads 360 variable. They must both be of the same general data type (that is, they must both be numbers, or text, or dates).
You can nest this function to create an if/then/else evaluation.
Examples
-
Converts a string to a number if the format matches the advertiser’s locale. Otherwise, returns 0:
If_error(To_number("1.067,30"), 0)
-
Returns “--” if there’s an error in the mid() function. Otherwise returns "Hello World!":
if_error(mid("Hello World!", 0, 20), "--")
-
Example of nested error checking. If there’s an error in the
mid()
function, the expression evaluates theleft()
function. If theleft()
function evaluates to an error, the expression returns “---”::
if_error(
mid("Hello World!", 0, 20),
if_error(left("Hello World!", 5), “---”)
)