ACCT 350 · Data Analytics for Accountants

Getting and Cleaning Accounting Data

Learn how to pull records out of accounting systems, check them against the books, and fix the mess before you analyze anything.

Key takeaways

  • Accounting data usually comes from a system's export, a report, or a direct database query, and each route has trade-offs.
  • Always tie the extracted data to a trusted total, such as a trial balance, before doing anything else.
  • Common problems are duplicates, blanks, inconsistent spellings, wrong data types and values out of range.
  • Keep the raw file untouched, do cleaning in a copy, and write down every change you make.
  • Cleaning decisions are judgments; record why you made each one so someone else can check you.

Priya runs Sweet Rise Bakery. She wants to know which supplier she spends the most with, so she exports a list of last month's supplier payments. The list looks fine until she sorts it by name. "Mill & Grain Co" appears three ways. "Blue Box Supply" shows up in capital letters and in normal letters. One payment has no supplier name at all. And two rows look exactly alike.

If she added up each name as written, she would get the wrong answer to a simple question. The data was not lying, exactly. It was just messy, the way real data always is. Fixing that mess, before any clever math, is the least glamorous and most important part of analytics. Experienced analysts often say it takes most of their time.

This lesson follows the second and third steps of the analytics loop: getting the data, then cleaning it.

Where accounting data comes from

Most businesses keep their records in accounting software or a larger system for planning resources, often called an ERP. Behind the screen sits a database: a set of tables with rows (one per event, such as one invoice line) and columns (one per fact, such as date or amount).

You can get data out in a few ways.

  • A built-in report. Easy and safe, but it shows what the software designers chose. The layout may be built for reading, not for analysis.
  • An export. Most systems export to a spreadsheet-style file. Exports are quick, but they may be limited to what is on screen and can cut off long reports.
  • A direct query. Someone writes a request, in a language such as SQL, to the database. This is the most flexible and the most powerful, and it usually needs help from the people who run the system.

Whatever route you choose, remember that you are looking at a copy of reality. Your first question about any extract is: "Is it complete, and is it the right slice?"

The path from system to analysis

From the ledger to a clean table
1 Request Decide which tables, dates and fields you need. 2 Extract Pull the file or run the query. Save an untouched copy. 3 Tie out Compare row counts and totals to a trusted source. 4 Clean Fix duplicates, blanks, spellings and types in a working copy. 5 Log Write down what you changed and why. 6 Use Hand the clean table to the analysis step. Request Decide which tables, dates and fields you need. 1 Extract Pull the file or run the query. Save an untouched copy. 2 Tie out Compare row counts and totals to a trusted source. 3 Clean Fix duplicates, blanks, spellings and types in a working copy. 4 Log Write down what you changed and why. 5 Use Hand the clean table to the analysis step. 6

Each step can introduce errors, so each step ends with a check.

The tie-out is the step accountants naturally love. A tie-out means checking that the extract's total equals a figure you already trust. For example, the total of all customer balances in the extract should match the "Accounts receivable" line on the trial balance. If it does not, something is missing, doubled or cut off, and nothing you do later will be reliable.

The usual suspects

After the tie-out, look for five kinds of trouble.

1. Duplicates. The same event appears twice. This happens when two reports are joined, when an export is run twice and pasted together, or when someone enters the same invoice again. A real duplicate usually shares a unique code, such as an invoice number, and not only an amount and date. Two bills of exactly $420 on the same day could be genuine.

2. Blanks. A field is empty. Is a blank "zero," "unknown," or "does not apply"? These mean different things. A blank supplier name is a problem; a blank "discount" may simply mean no discount.

3. Inconsistent labels. "Mill & Grain Co," "mill and grain co." and "MILL & GRAIN CO" are one supplier to a person and three to a computer. Extra spaces, punctuation and capital letters all cause this.

4. Wrong types. Dates stored as text will not sort in order. Amounts stored as text, with a dollar sign or a comma, will not add. A date like 03/04/2026 means March 4 in the United States but April 3 in many other countries, so confirm the format.

5. Impossible or odd values. A payment dated next year. A quantity of −3 where negatives make no sense. An amount with an extra zero. Some oddities are errors, and some are real events like returns, so investigate before deleting.

Messy and clean, side by side
Before cleaning Mill & Grain Co mill and grain co. MILL & GRAIN CO Blue Box Supply BLUE BOX SUPPLY (blank supplier) After cleaning Mill & Grain Co Mill & Grain Co Mill & Grain Co Blue Box Supply Blue Box Supply Blue Box Supply (traced from invoice) VS Before cleaning Mill & Grain Co mill and grain co. MILL & GRAIN CO Blue Box Supply BLUE BOX SUPPLY (blank supplier) After cleaning Mill & Grain Co Mill & Grain Co Mill & Grain Co Blue Box Supply Blue Box Supply Blue Box Supply (traced from invoice)

The same payments before and after standardizing. The money has not changed; only the labels have.

A worked example: Priya's supplier payments

Here is last month's export. Each row shows the invoice number, supplier as typed, and amount paid.

Row  Invoice  Supplier            Amount
1    A-101    Mill & Grain Co       420
2    A-101    mill and grain co.    420
3    A-107    Mill & Grain Co       380
4    B-220    Blue Box Supply       150
5    B-231    BLUE BOX SUPPLY        95
6    C-015    Spark Energy          210
7    B-240    (blank)                60

Step 1: Add the raw amounts. 420 + 420 + 380 + 150 + 95 + 210 + 60 = 1,735.

Step 2: Tie out. Priya's ledger shows total supplier payments of $1,315 for the month. The export says 1,735, which is 420 too high. The difference equals one $420 row, which is a strong hint of a duplicate.

Step 3: Investigate. Rows 1 and 2 have the same invoice number, A-101, and the same amount. Only the spelling differs. That is a true duplicate, since an invoice is paid once. Remove row 2 from the working copy and log the reason.

From the raw export to the ledger total
Raw export $1,735 Duplicate A-101 ($420) Ledger total $1,315 Raw export $1,735 Duplicate A-101 ($420) Ledger total $1,315

Removing the one duplicate payment makes the extract agree with the books. Example with made-up numbers.

Step 4: Fix the blank. Row 7 has invoice B-240, and the invoice register shows B-240 came from Blue Box Supply. Fill in the supplier and log the source.

Step 5: Standardize names. Make every spelling of Mill & Grain Co identical, and every Blue Box Supply identical.

Step 6: Re-check. The clean table now has six rows: 420 + 380 + 150 + 95 + 210 + 60 = 1,315, which matches the ledger.

Step 7: Now, and only now, answer Priya's question by adding per supplier.

Mill & Grain Co:    420 + 380       = 800
Blue Box Supply:    150 + 95 + 60   = 305
Spark Energy:                       = 210
Total:              800 + 305 + 210 = 1,315

The top supplier is Mill & Grain Co at $800, which is about 61% of the total (800 ÷ 1,315 ≈ 0.608). Had Priya skipped cleaning and added by name as typed, she would have seen Mill & Grain's money split across spellings, with the duplicate inflating the total, and Blue Box would have looked smaller than it was. A wrong supplier ranking could have led to a wrong negotiating plan.

Habits that keep you honest

Cleaning data gives you power to change numbers, so do it with discipline.

  • Never edit the original. Save the raw extract with its date and keep it. Work in a copy so you can always start again.
  • Prefer rules to hand edits. A rule like "make names lowercase and trim extra spaces" can be repeated and explained. Hand typing fixes in 400 rows cannot.
  • Keep a cleaning log. Each entry says what was changed, how many rows were affected, and why. Auditors and managers will ask, and your future self will too.
  • Count at every step. Write down the row count and total before and after each fix. Surprises show up as changes you did not expect.
  • Do not delete what you do not understand. If a strange value might be real, mark it and ask. Fraud and errors both hide in strange values, which a later lesson explores.

Asking the people who know the system

Data does not explain itself. The person who enters invoices every day knows things no export shows: that a "void" status means the invoice was cancelled, that old customers were loaded in bulk from a prior system, or that a field called "Notes" is where staff type discounts. A ten-minute conversation can save a week of wrong guesses.

Good questions to ask the system's owner before you extract:

  • Which fields are filled in by hand, and which by the software?
  • Were there any changes to the system, the chart of accounts or the process during the period?
  • Are cancelled, voided or reversed items kept in the table or removed?
  • Are amounts shown before or after tax and discounts?

The answers tell you what to expect when you tie out. If voided invoices stay in the table with a status flag, then adding every row will overstate sales. You would filter them out first, and then the total should match the ledger. Learning that from a person is far cheaper than discovering it from a puzzling mismatch.

A common mistake: cleaning the answer in

The most dangerous mistake is cleaning with the answer in mind. Suppose a manager hopes expenses look low and an analyst "cleans" the largest expenses out as outliers. The data now supports the hope, and the result is misleading. Delete or change values only for a reason you could explain to an outsider, and apply the same rule to every row. If you remove outliers, say so in the report.

Another slip is stopping after the first tie-out. A total can match while the rows underneath are wrong, for example if a duplicate is balanced by a missing row. Totals catch many errors but not all, so sample a few rows and compare them with source documents like invoices too. The rules for what the data is and who may use it are covered in the next lesson.

Words to know

Extract a copy of data pulled out of a system for analysis.

Tie-out checking that an extract's total or count matches a trusted figure, such as the trial balance.

Duplicate the same event recorded twice, often detectable by a shared unique code.

Standardizing making labels, dates and formats consistent so equal things look equal.

Data type the kind of value a field holds, such as text, number or date.

Outlier a value far from the others, which may be an error or a real unusual event.

Cleaning log a written record of every change made to the data and the reason.

Check yourself

  1. Why should you save an untouched copy of the raw export before cleaning?
  2. What is a tie-out, and what would you compare an accounts receivable extract against?
  3. An export totals $2,950 and the ledger shows $2,500. One row of $450 is suspected as a duplicate. Does removing it fix the difference? Show the arithmetic.
  4. Why is a shared invoice number better evidence of a duplicate than a shared amount and date?
  5. In Priya's clean table, what share of the $1,315 went to Blue Box Supply? Round to a whole percent.
  6. Explain why deleting "outliers" until the data fits a manager's hope is dangerous.
Show the answers
  1. It lets you restart if a fix goes wrong and proves what the system originally produced.
  2. A tie-out compares the extract's total or row count with a trusted figure; compare the extract to the Accounts receivable balance on the trial balance.
  3. Yes: 2,950 − 450 = 2,500, which equals the ledger total.
  4. An invoice is normally paid once, so a repeated number points to the same event, while two real bills can share an amount and date by coincidence.
  5. 305 ÷ 1,315 ≈ 0.232, so about 23%.
  6. It changes the data to support a conclusion chosen in advance, so the result misleads readers; remove values only by a stated rule applied to every row and disclose it.

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: The analytics process

  1. Analytics and the AccountantData analytics turns the records accountants already keep into answers, and this lesson maps the whole process from question to action.11 min
  2. Asking Good Questions of DataA sharp, specific question decides whether analysis helps; learn to turn a vague worry into one that records can answer.10 min
  3. Getting and Cleaning Accounting DataLearn how to pull records out of accounting systems, check them against the books, and fix the mess before you analyze anything.10 min
  4. Data Types, Quality and GovernanceKnow what kind of data you hold, how to score its quality, and who is allowed to touch it before you trust or share any result.10 min

In the news