ACCT 350 · Data Analytics for Accountants

Finding Anomalies and Benford's Law

Learn how auditors spot odd transactions, from simple outlier checks to the surprising pattern in first digits called Benford's Law.

Key takeaways

  • An anomaly is a record that does not fit the pattern of the rest. It is a reason to look closer, not proof that anything is wrong.
  • Simple tools find many anomalies: sorting, counting duplicates, and measuring how far a value sits from the typical one.
  • Benford's Law says that in many real sets of money amounts, small leading digits are far more common than large ones, and about 30.1% begin with a 1.
  • A digit test works on the whole population at once, so it points at a pattern (such as amounts crowding below an approval limit) instead of one number.
  • Every flag needs a human follow-up, because honest data can also look strange.

Here is a strange fact. Pull up the amounts of a thousand real invoices and look only at the first digit of each one. You might expect the digits 1 through 9 to show up about equally, each in roughly one invoice out of nine. They do not. About three invoices in ten start with a 1. Fewer than one in twenty start with a 9.

Now picture Maya, who runs a smoothie cart that has grown into a small business with a few hundred suppliers. Her bookkeeper, Dev, notices that a few payments look odd. One is far too large. One vendor is paid twice a week. Another has invoices that all land just under $5,000, which happens to be the amount Maya must personally approve. Dev cannot read every line. He needs a way to let the data point at the lines worth reading. That is what anomaly detection does, and the first-digit pattern is one of its most famous tools.

What an anomaly really is

An anomaly is a record that stands apart from the pattern of the others. Maybe it is unusually big, unusually timed, or just unusually shaped. The key word is unusual, not wrong. A $40,000 payment to the landlord is an outlier in a ledger full of $200 supply invoices, but it is also the annual rent prepayment that everyone knew about.

This matters because beginners treat a flag as a verdict. Do not. Think of a smoke detector. It goes off for burnt toast as readily as for a real fire. Its job is to make you look, and your job is to smell the air. In accounting, the "smell the air" step means pulling the invoice, asking the manager, or checking the contract.

Good analysts also remember two kinds of mistakes. A false positive is a flag on something perfectly fine. A false negative is a problem that never got flagged. Tighten the detector and you get fewer false positives but miss more real problems. Loosen it and you drown in toast. Choosing the setting is a judgment call, and it depends on the cost of looking versus the cost of missing something. A payroll check for ghost employees deserves a looser net than a check on office-supply coupons.

The easy checks come first

Before any clever math, run the plain tests. You learned the building blocks in Descriptive Analysis of Ledgers, and they find a surprising share of problems.

  • Sort and look at the ends. The biggest and smallest amounts, the earliest and latest dates.
  • Count duplicates. The same vendor, amount and date appearing twice is a classic double payment.
  • Look for gaps. Check numbers jump from 1041 to 1047? Where did 1042 to 1046 go?
  • Check the calendar. Entries on a Sunday, on a holiday, or at 2 a.m. may be perfectly fine, or not.
  • Look for round numbers. Real expenses are rarely exactly $2,000.00 again and again.

A step beyond sorting is asking how far a value sits from the typical one. Suppose Maya's weekly fruit purchases average $600, and most weeks fall within about $50 of that. A week of $900 sits $300 above average, which is six of those $50 steps. Statisticians call a step like that a standard deviation, a typical distance from the average. A value six steps away is rare enough to deserve a phone call. A week of $640 is not.

From raw ledger to a short list of questions
1 Collect the ledger Export every transaction for the period, with dates, vendors and amounts. 2 Run simple tests Sort, count duplicates, look for gaps and round numbers. 3 Run a pattern test Compare the whole set to what normal data looks like, such as Benford's Law. 4 Rank the flags Put the strangest and largest items first. 5 A person investigates Pull the support, ask questions, decide if it is a real problem. Collect the ledger Export every transaction for the period, with dates, vendors and amounts. 1 Run simple tests Sort, count duplicates, look for gaps and round numbers. 2 Run a pattern test Compare the whole set to what normal data looks like, such as Benford's Law. 3 Rank the flags Put the strangest and largest items first. 4 A person investigates Pull the support, ask questions, decide if it is a real problem. 5

Each step narrows the pile. The last step is always a person.

The surprising pattern in first digits

Now for the strange fact from the start. In 1881 an astronomer named Simon Newcomb noticed that the early pages of library books of logarithm tables were more worn than the later pages. People looked up numbers starting with 1 far more than numbers starting with 9. In 1938 a physicist named Frank Benford tested the idea on many kinds of data and found the same thing. We call the pattern Benford's Law.

The rule is that the chance a number starts with the digit d is log₁₀(1 + 1/d). You do not need to love logarithms to use it. A calculator or a spreadsheet gives the answer, and the results are easy to remember.

Benford's Law in one line
P(d) = log₁₀(1 + 1/d) P(d) = Chance of first digit d The share of amounts whose first digit is d, for d from 1 to 9. log₁₀(1 + 1/d) = Log of one plus one over d A button on any scientific calculator and a function in every spreadsheet. P(d) = log₁₀(1 + 1/d) P(d) = Chance of first digit d The share of amounts whose first digit is d, for d from 1 to 9. log₁₀(1 + 1/d) = Log of one plus one over d A button on any scientific calculator and a function in every spreadsheet.

Put d = 1 in and you get log₁₀(2), about 0.301, so 30.1% of amounts start with a 1.

Here are the nine answers, rounded to one decimal place:

First digit 1 2 3 4 5 6 7 8 9
Expected share 30.1% 17.6% 12.5% 9.7% 7.9% 6.7% 5.8% 5.1% 4.6%

Those nine shares add up to 100.0%. Notice how fast they fall. A 1 is about six and a half times as common as a 9.

Why would money behave this way?

Think about a price growing at 10% a year. Starting at $100, it needs a full year of growth to climb from $100 to $200, so it spends a long time with a leading 1. Going from $200 to $300 takes less time, because it is now a smaller step in percentage terms. By the time it is at $900, it needs only about 11% more to reach $1,000, and the leading 1 comes round again. Quantities that grow by percentages spend the most time with small leading digits. Sales, invoices, populations and account balances all grow that way.

This also tells you when the law does not fit:

  • Numbers that are assigned, like check numbers, invoice numbers or ZIP codes. They are labels, not amounts.
  • Numbers squeezed into a narrow range. Shoe prices that run from $60 to $95 all start with 6, 7, 8 or 9.
  • Numbers with a built-in cap or floor. If a company policy says no meal receipt may exceed $75, the high end is cut off. A fixed fee, such as every bill being $29.99, does the same.
  • Small data sets. With 40 invoices, chance alone can wobble the digits a lot. Analysts like at least a few hundred records, and more is better.

The best data for the test spans several orders of magnitude, from tens to thousands or beyond, and comes from many separate events. Think accounts receivable, vendor payments, expense claims and journal entries.

Worked example: two sets of a thousand payments

Dev pulls 1,000 vendor payments for Maya's business and counts the first digits. He wants to compare them to what Benford predicts. With 1,000 records, the expected counts are just the percentages multiplied by 10: 301, 176, 125, 97, 79, 67, 58, 51 and 46, which add to 1,000.

Digit   Expected   Actual (set A)   Gap (A - expected)
1         301         298               -3
2         176         172               -4
3         125         121               -4
4          97          95               -2
5          79          80               +1
6          67          70               +3
7          58          60               +2
8          51          53               +2
9          46          51               +5
Total    1000        1000                0

The gaps are tiny. Set A looks healthy. To put a number on it, analysts often add up (actual − expected)² ÷ expected for each digit, a score called chi-square. For set A the nine pieces are 0.03, 0.09, 0.13, 0.04, 0.01, 0.13, 0.07, 0.08 and 0.54, which total about 1.1. For nine digits, a score above about 15.5 would be unusual enough to flag at the common 5% level. So 1.1 is nothing to worry about.

Now Dev checks a second set from a different vendor group.

Digit   Expected   Actual (set B)   Gap (B - expected)
1         301         250               -51
2         176         150               -26
3         125         100               -25
4          97         230              +133
5          79          60               -19
6          67          55               -12
7          58          50                -8
8          51          45                -6
9          46          60               +14
Total    1000        1000                 0

The 4s jump out: 230 observed against 97 expected. The chi-square score for the 4s alone is 133² ÷ 97 = 17,689 ÷ 97, about 182. All nine digits together give roughly 212.6, far past 15.5. Something is pushing payments toward amounts starting with 4.

Remember Maya's $5,000 approval limit? Payments of $4,800, $4,900 and $4,950 all start with 4. That is a clue, not a conviction. The next step is to list every payment from $4,000 to $4,999, group them by who approved them and which vendor was paid, and read the support. Maybe a contract really has a fixed monthly fee of $4,500, which would explain the spike with no wrongdoing at all.

Expected shares vs set B
Share of payments (%) Benford expected Set B actual Spike at 4 Expected falls smoothly First digit Share of payments (%) Benford expected Set B actual Spike at 4 Expected falls smoothly First digit

The solid line slopes smoothly down. The dashed line has a hump at 4. That hump is what a trained eye catches in two seconds.

Other places the digit test can look

The first digit is only the start. Auditors also check:

  • The first two digits. There are 90 possible pairs, 10 through 99, so a spike at 48 or 49 (just under a limit at $4,900) is easier to see.
  • The last two digits. In large, honest data these should be roughly equal, with each pair near 1%. Too many ending in 00 suggests estimates or made-up figures.
  • Duplicates of whole amounts. The same unusual number appearing again and again.

Some auditors also keep a list of "limits" the business uses: approval thresholds, petty-cash caps, and the amount at which a second signature is needed. Amounts that crowd just below those lines are worth a separate test. People who test a control often find the edge of it. For a deeper look at how auditors use these tools in practice, see Analytics in Auditing.

A common mistake: treating a flag as a finding

The most common beginner error is to run the test, see a spike, and announce a fraud. Do not. A spike is a question. Honest explanations are many: a fixed price, a contract with a standard fee, a data-entry system that adds a prefix, a new product at a single price, or a large batch of similar refunds. A good analyst writes down the flag, lists the likely innocent reasons, tests each one against the records, and only then escalates what is left.

The opposite mistake is just as real. A test that passes does not prove the books are clean. Someone careful enough to spread fake amounts across all digits will pass a Benford test. That is why anomaly tests are one layer among several, along with the controls and the human judgment you will meet again in Classification and Clustering in Plain English. And this lesson teaches how to notice warning signs, not how to hide anything.

Finally, check current standards before you rely on a specific test in a real engagement. Audit methods, software and professional guidance change, so the PCAOB, the AICPA and your firm's own methodology are the places to confirm what is expected today.

Words to know

Anomaly a record that does not fit the pattern of the others and deserves a closer look.

Outlier a value far from the typical one, often found by sorting or by measuring distance from the average.

Standard deviation a typical distance of values from their average, used to judge how unusual a value is.

Benford's Law the pattern that in many real money data sets, about 30.1% of amounts start with 1 and only 4.6% start with 9.

False positive a flag on a record that turns out to be perfectly fine.

Chi-square score a total of (actual − expected)² ÷ expected across digits, where a big number means the data differs from the pattern.

Approval threshold the amount above which a higher level of sign-off is required, which makes nearby amounts worth a second look.

Check yourself

  1. What does the word "anomaly" mean, and why is a flagged record not proof of a problem?
  2. According to Benford's Law, what share of amounts should start with the digit 1, and what share with 9?
  3. In a set of 2,000 honest payments, about how many would you expect to start with a 3? (Use 12.5%.)
  4. Name two kinds of numbers for which Benford's Law is a poor test, and say why.
  5. In set B above, 230 payments started with 4 but only about 97 were expected. What is the gap, and what real-world cause might Dev check first?
  6. Explain why a data set that passes a Benford test might still contain fraud.
Show the answers
  1. An anomaly is a record that stands apart from the pattern; a flag only says "look here," and the cause may be innocent, such as a prepaid annual rent.
  2. About 30.1% start with 1 and about 4.6% start with 9, from log₁₀(1 + 1/d).
  3. 2,000 × 12.5% = 250 payments.
  4. Assigned numbers like check or invoice numbers (they are labels, not amounts), and capped or narrow-range numbers like a $29.99 fixed fee, because their first digits are forced.
  5. The gap is 230 − 97 = 133 extra payments; Dev should check payments between $4,000 and $4,999, since they may be clustering under a $5,000 approval limit, and also whether a fixed-fee contract explains them.
  6. A careful person can spread fake amounts across all the digits so the totals match the pattern, so the test catches only careless patterns and is one layer among several.

A free self-study program written for 4Accounting with AI writing tools and not reviewed line by line by a person. It is not an accredited degree and awards no credit. Check anything you rely on against a textbook or primary source. Report an error.

In this unit: Methods

  1. Descriptive Analysis of LedgersUse totals, averages, medians, groupings and trends to describe what a ledger says, and learn when each summary misleads.10 min
  2. Visualizing Financial DataChoose charts that show financial patterns honestly, avoid tricks like cut-off axes, and make each picture answer one clear question.11 min
  3. Regression and Forecasting in AccountingFit a straight line to past data, use it to forecast, and learn how to judge when a prediction can be trusted.10 min
  4. Finding Anomalies and Benford's LawLearn how auditors spot odd transactions, from simple outlier checks to the surprising pattern in first digits called Benford's Law.12 min
  5. Classification and Clustering in Plain EnglishTwo machine-learning ideas explained without jargon: sorting records into known labels, and letting the data reveal its own groups.12 min

In the news