Evaluates to true if haystack ends with needle.


ends_with(haystack, needle)

haystack and needle can be any of the following:

  • A String constant, such as "GDN".
  • A Search Ads 360 variable that is a String, such as Keyword, Campaign, Engine_status, and so on.
  • An expression or formula column that returns a String.

Case insensitive

Text comparisons are case insensitive. That is, ends_with("gdn", "GDN") evaluates to true.

Empty character

If you include an expression or formula column in this function, the expression or formula column could evaluate to an empty string.

Be aware that all Strings end with an empty (zero-length) String. That is, ends_with("GDN", "") evaluates to true.

Note that ends_with("", "GDN") evaluates to false. That is, an empty String does not end with non-empty Strings.


  • [ends_with("hook", "fishhook")] is true.

  • If adgroup name ends with "shoes", replace "shoes" with "sneakers":
    [if(ends_with(ad_group, "shoes"), replace(ad_group, len(ad_group) - 4, 5, "sneakers"), ad_group)]

Was this helpful?
How can we improve it?