Using the NOTEXIST function
NOTEXIST(...) function checks if there are no contained items matching 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.
NOTEXIST is a convenience function that makes simple counting checks looking for 0 contained items simpler to write.
NOTEXIST(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.
NOTEXIST(keywords, labels = ("abc", "xyz") )
Checks if there are no keywords that have 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.
NOTEXIST(callextensions; sitelinks, approvalstatus = approved)
Checks if there are no approved sitelinks or call extensions associated with the campaign or ad group.
Checks if there are no ads of any type in the campaign or ad group.
Checks if there are no labels applied to the item being filtered. This can even be applied to non-containers, such as keywords, to see all keywords which contain no labels.
- 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,
NOTEXIST(ads, OR(status = paused approvalstatus = disapproved))will check if there are no ads which are 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:
NOTEXIST(keywords; sitelinks, keywordwordcount = 2 linktext : "local")will check for the non-existence of keywords having exactly 2 words and associated sitelinks that contains "local" in their link text.
Using the NOTEXIST 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,
NOTEXIST(keywords) at the campaign level shows the campaign if it has no keywords in any ad groups 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,
NOTEXIST(audiences) at the campaign level will show the campaign if it is missing campaign-level audiences, even if it contains ad group-level audiences. The same is true for extensions:
NOTEXIST(sitelinks) at the campaign level will only consider campaign-level sitelinks, not ad group-level sitelinks within the campaign.