# macro field in CQL: syntax and examples (Confluence)

URL: https://goingstellar.ro/reference/cql/macro-field/

The macro field matches content whose body contains at least one instance of the named macro. Use it to audit where a macro is used before you change or retire it, or to find pages that still use an old report or include macro.

## Syntax

```
macro = macro-name
macro IN (macro-name, macro-name)
```

## Arguments

- `macro-name` (optional: yes): The macro's name as Confluence stores it, for example panel, expand or details. Names that contain a hyphen must be quoted.

## Works with

- Operators: =, !=, IN, NOT IN (as documented).
- Not with: ~, !~, >, >=, <, <=. The documentation lists no supported functions.

## Examples

```
macro = panel AND space = SD
```

Find the pages in one space that use the Panel macro, for example before you restyle your callouts. Run on Confluence Cloud on 2026-11-29.

```
macro in (toc, widget)
```

The documentation's example: pages that have a Table of Contents or a Widget Connector macro in the body. Run on Confluence Cloud on 2026-11-29.

```
macro = jira
```

Find content that embeds Jira issues with the Jira issue macro. A space where nobody uses it gives an empty list, which is also a useful answer. Run on Confluence Cloud on 2026-11-29.

```
macro in ("page-properties", details) AND space = SD
```

Pages that carry a properties table, checking both names that the macro may be stored under. The quotes are needed for the hyphen. Run on Confluence Cloud on 2026-11-29.

```
macro = expand AND lastmodified < now("-4w")
```

Pages with an Expand section that nobody has touched for four weeks, a short list to review for stale hidden content. Run on Confluence Cloud on 2026-11-29.

```
macro != toc AND space = SD AND type = page
```

Pages in a space that have no table of contents, so you can decide where one is missing. Run on Confluence Cloud on 2026-11-29.

## Pitfalls

- A macro name with a hyphen needs quotes. `macro = recently-updated` fails with "Could not parse cql", while `macro = "recently-updated"` runs and finds the page that uses it (checked on Confluence Cloud, November 2026).
- The name is case sensitive. `macro = panel` finds pages, `macro = PANEL` and `macro = Panel` run without an error and match nothing (checked on Confluence Cloud, November 2026).
- A name that does not exist is not an error. `macro = cheese` simply returns an empty list, so a typo looks the same as "nobody uses it". Test a name you are sure of first.
- `macro ~ toc` is rejected with "Operator '~' is not supported for field 'macro'". Use `=` or `IN` with the exact name.

## Related

- [IN](https://goingstellar.ro/reference/cql/in-operator/)
- [NOT IN](https://goingstellar.ro/reference/cql/not-in-operator/)
- [Reserved characters and words](https://goingstellar.ro/reference/cql/reserved-words/)
- [space](https://goingstellar.ro/reference/cql/space-field/)
- [type](https://goingstellar.ro/reference/cql/type-field/)
- [lastmodified](https://goingstellar.ro/reference/cql/lastmodified-field/)

## Sources

- [CQL fields (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/cql-fields/)

