New Tool Radar

AI for Data & Spreadsheets

How to Check an AI-Extracted Table Row Count Against the Source Document

Count the rows in the source document and in the AI-extracted table, then find any rows the extraction dropped or duplicated.

Schematic with three steps: Count the source rows; Count the extracted rows; Find the missing or extra rows by.

Row count is the fastest check on an extraction: if the source has 40 rows and the sheet has 38, two rows are missing and no value check will find them by sampling. Count first, then hunt the missing rows by their identifiers.

What you need

  • The source document with its table
  • The extracted table in a sheet
  • An identifier column, such as an ID or date, present in both

Step 1: Count the source rows

Count the data rows in the source table, excluding the header and any total or footer rows. Write the count down with the page numbers the table spans.

Step 2: Count the extracted rows

Count the data rows in the extracted sheet the same way, excluding headers and totals. If the counts match, move on to value checks; if they differ, note the size of the gap.

Step 3: Find the missing or extra rows by identifier

Sort both lists by the identifier column and compare them side by side. Rows in the source with no match in the sheet were dropped; rows in the sheet with no match in the source were duplicated or invented.

Worked example: synthetic 40-row source table

The table below is a synthetic example. It shows the expected result of a row-count check; no document was read and no extraction was run.

Check Count Result
Data rows in the source 40 Source
Data rows extracted 38 2 short
Identifiers matching 38 Pass
Source rows with no match 2 Rows 31 and 32 missing
Extracted rows with no source match 0 No invented rows

Expected result (UNTESTED). the source has 40 rows and the extraction has 38; rows 31 and 32 were dropped where the table continues across a page break. Add them from the source before using the table. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • Total and subtotal rows inside a table inflate the count if they are not excluded on both sides.
  • A row that wraps onto two lines in the source can be extracted as two rows, inflating the count.
  • Matching row counts do not prove the values are right; check values next.

Sources

See all