Product guides

Match all or match any: choosing the logic of a rule

A rule with several conditions can require every one or just one. See how to choose the right logic and avoid rules that catch too much or too little.

Editorial illustration for Match all or match any: choosing the logic of a rule

The moment a rule has more than one condition, a question appears: must a transaction meet all of them, or is any one enough? The rule editor offers both choices, labelled match all and match any. They sound similar and behave very differently, and picking the wrong one is the most common reason a rule catches the wrong things.

The difference in plain terms

Match all means every condition must be true. It narrows. Add a condition and the rule becomes stricter, catching fewer transactions. Match any means at least one condition must be true. It widens. Add a condition and the rule catches more.

A helpful way to remember: match all is and, match any is or. If you say the conditions aloud joined by and, you want match all. If you would naturally join them with or, you want match any.

When to choose match all

Use match all when you want precision. For example, a rule for money out, from one particular merchant, above a set amount. Each added condition removes false matches. This is the right choice for rules that change something important, such as marking spending as business or excluding it from reports, where a stray match would distort figures.

  • Money out **and** a given merchant **and** a given amount range.
  • No receipt **and** large amount **and** a business account.
  • A specific narration **and** a specific account.

When to choose match any

Use match any when several different signals all point to the same outcome. A common case is one category served by many merchants: groceries from three stores, or fuel from several stations. Rather than writing three rules, one rule with three merchant conditions and match any does the job.

  • Merchant A **or** merchant B **or** merchant C, all filed under groceries.
  • Narration containing one word **or** another, both meaning the same utility.
  • Payment from one account **or** another when both are used for the same purpose.

Match any is also useful for synonyms. Bank descriptions for the same payee often vary, and listing the variants under one rule keeps the logic in one place.

Mistakes that catch people out

The classic error is writing conditions that are all required but cannot all be true together. A rule that demands both money in and money out will never match anything. The reverse mistake is using match any with a broad condition. Adding one loose condition, such as a very wide amount range, can make the whole rule match nearly everything.

Another subtle issue arises when mixing a broad test with a narrow one. With match any, the broad one dominates. If you find yourself wanting both a broad catch-all and a narrow exception, split them into two rules and use rule order to separate them.

Test before trusting

The preview of what a rule would match is the best defence. Switch the logic and watch the preview change. If flipping from all to any suddenly matches hundreds of transactions, you have learned how loose the rule becomes. Read a few of the matches before saving, especially those at the edges.

GoalLogicEffect of adding a condition
Narrow to a precise caseMatch allFewer matches
Gather several equivalentsMatch anyMore matches
Catch a special caseSeparate ruleCleaner reasoning

Combining groups of conditions

Sometimes a rule needs both kinds of logic at once, for example any of three merchants, but only for money out above a certain amount. A single rule has one logic setting, so the cleanest answer is usually two rules or a slightly different framing. Resist forcing complicated logic into one rule; two simple, well-named rules are easier to read, test and fix than one clever one.

A habit worth forming

Whenever a rule has more than one condition, read it back as a sentence including the word all or any. If the sentence does not make sense, the logic is wrong. That thirty-second check prevents the confusion that comes from rules that behave in ways their author did not intend.

SPENDIXAI JOURNAL

Useful ideas start with a clearer picture of your own spending.

Explore your reports