if_error

Evaluates value. If value returns an error, the function evaluates the alternative defined in error_value. Otherwise, the function returns value.

Note: This function is only available in Templates and can’t be used in Reporting.

Syntax

if_error(value, error_value)

Parameters

value and error_value can be an expression or one of the Search Ads 360 variables. They must both be of the same general data type which means that both the parameters must be either numbers, text, or boolean.

You can nest this function to create an if, then, or 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 the left() function. If the left() function evaluates to an error, the expression returns “---”::
    if_error(
      mid("Hello World!", 0, 20),
          if_error(left("Hello World!", 5), “---”)
    )

Related links

Was this helpful?

How can we improve it?

Need more help?

Try these next steps:

true
Search
Clear search
Close search
Google apps
Main menu
534945957074391743
true
Search Help Center
true
true
true
true
true
5055977
false
false