if

Evaluates [condition] and returns [if_true] if the condition is true and [if_false] if the condition is false. The return value will be the same type as [if_true] and [if_false].

Syntax

  • if(condition, if_true, if_false)
    A single condition.

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

Parameters

  • condition: an expression that evaluates to true or false.
  • if_true and if_false: an expression, any data type, or any Search Ads 360 variable. They must both be of the same general data type which means 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 of clicks reported today is within 15% of the weekly average.

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
12612656693410047878
true
Search Help Center
true
true
true
true
true
5055977
false
false