if

Evaluates a condition and returns one value if the condition is true, and a different value if the condition is false.

Syntax

  • if(condition, true, else)
    A single condition.
  • if(condition1, true1, condition2, true2, condition3, true3, [ ... ] else))
    Nested conditions.

Note that the evaluation must end with the else result (the result of the evaluation if all conditions are false).

Parameters

  • condition: an expression that evaluates to true or false.
  • true and else: 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).

Examples

  • if(Impr / Num_days() < 10, "Very low run rate", "")
    If you added this function to an ads reporting table, the column containing this function would output "Very low run rate" for ads that received fewer than 10 impressions.

  • if(Cost.For_Date_Range(today()) >= .9*Daily_Budget, "Over 90% Spent today", "---" )
    If you added this function to a campaigns reporting table, the column containing this function would output:

    • "Over 90% Spent today" for campaigns that have spent more than 90% of the daily budget so far today.
    • "---" for campaigns that have spent less than 90% of the daily budget so far today.
  • if(
      Clicks.For_Date_Range(Today()) > (1.15*(Clicks.For_Date_Range(Last_7_days())/7)),

        "15%+ above Average",
      Clicks.For_Date_Range(Today()) < (.85*(Clicks.For_Date_Range(Last_7_days())/7)),
        "<15% below Average",
      "Within Range")

    If you added this function to a campaigns reporting table, the column containing this function would output:

    • "15%+ above Average" if the number of clicks reported today is more than 15% above the weekly average.
    • "<15% below Average" if the number of clicks reported today is more than 15% below the weekly average.
    • "Within Range" if the number if clicks reported today is within 15% of the weekly average.
Was this helpful?
How can we improve it?