Using the EXIST function
EXIST(...) function checks if at least one contained item matches an optional filter. When checking, you specify the types for which contained items should be searched, and optionally a child filter to indicate which contained items should be searched. Contained items not matching the child filter or not of the specified types aren't considered. If the filter isn't specified, the function will look for any item of the specified types.
EXIST is a convenience function that makes simple counting checks looking for at least one contained item simpler to write.
EXIST(types, filter) is equivalent to
COUNT(types, filter) > 0.
types-- the types of contained items to consider.
filter[optional] -- contained items must match this filter condition to be considered.
EXIST(keywords, labels = ("abc", "xyz") )
Checks if there is at least one keyword that has the labels "abc" or "xyz" contained in the campaign or ad group. In this example, "keywords" is the the type of item to look for, while "labels = ("abc", "xyz")" is the child filter.
EXIST(callextensions; sitelinks, approvalstatus = approved)
Checks if there is at least one approved sitelink or call extension associated with the campaign or ad group.
Checks if there is at least one ad of any type in the campaign or ad group.
Checks if there is at least one label applied to the item being filtered. This can even be applied to non-containers, such as keywords, to see all keyword which contain at least one label.
- If there are multiple conditions in the child filter, they must all match for the item to be considered. They can be wrapped in an OR function to look for items matching any of the conditions. For example,
EXIST(ads, OR(status = paused approvalstatus = disapproved))will check if there is at least one ad which is either paused, disapproved, or both.
- The filter can contain conditions that only apply to some types and those conditions will be ignored for the types they don't apply to. For example:
EXIST(keywords; sitelinks, keywordwordcount = 2 linktext : "local")will check for the existence of either a keyword having exactly 2 words or an associated sitelinks that contains "local" in its link text, or both.
Using the EXIST function with campaigns and ad groups
For items that can only be contained within ad groups, checking at the campaign level will find any item from any ad groups. For example,
EXIST(keywords) at the campaign level shows the campaign if it has at least one keyword in at least one ad group of the campaign.
For items that can be contained within ad groups or campaigns, checking at the campaign level will only find items directly within the campaign. For example,
EXIST(audiences) at the campaign level will only show the campaign if it has at least one campaign-level audience. It will not show the campaign if it only has ad groups with ad group-level audiences. The same is true for extensions:
EXIST(sitelinks) at the campaign level will only consider campaign-level sitelinks, not ad group-level sitelinks within the campaign.