Logical
Flag out-of-sequence, skipped, and duplicate invoice or serial numbers
Audit sequential check, voucher, and batch serial logs to classify exact "+1 OK" transitions versus missing-number gaps, duplicates, and reversals.
Classify adjacent numeric serial transitions
Compare each numeric serial with the immediately preceding row. This is an adjacent-transition diagnostic, not a completeness or compliance audit. A jump identifies numbers absent between those two rows; they may appear elsewhere, be voided, or belong to another numbering series.
Duplicate means equal adjacent values only. A nonadjacent duplicate can appear as a reversal or a jump; use a separate whole-column duplicate check. Preserve the intended source order and partition independent sequences before applying this example.
The example accepts nonnegative whole numeric serials only. Text identifiers, leading-zero codes, decimals and blank records require separate parsing or policy; they are not silently coerced. The summary reports invalid inputs if any helper is missing or invalid.
| Row | Check / Voucher # (A) | Prior # | Audit Status Classification (B) |
|---|---|---|---|
| Row 2 | 1001 | — | Start of sequence |
| Row 3 | 1002 | 1001 | "OK" (+1 sequential) |
| Row 4 | 1005 | 1002 | "Gap (2 Missing)" (#1003–1004 skipped!) |
| Row 5 | 1006 | 1005 | "OK" (+1 sequential) |
| Row 6–7 | 1006, then 1004 | 1006 | "Duplicate", then "Out of Order" |
Classify sequential, duplicate, skipped-gap, and reversed serial codes
Enter in B3 and copy down. Gap count describes this pair of rows, not a proven count of missing documents.
=IF(COUNT(A2:A3)<>2,"Invalid inputs",IF(OR(A3<0,A2<0,A3<>INT(A3),A2<>INT(A2)),"Invalid inputs",IF(A3 = A2 + 1, "OK", IF(A3 = A2, "Duplicate", IF(A3 > A2 + 1, "Gap (" & (A3 - A2 - 1) & " Missing)", "Out of Order")))))Total sequence exceptions across the register
Count non-OK transitions only after validating all five helper results. This is a transition count, not the number of missing serials.
=IF(OR(COUNTBLANK(B3:B7)>0,COUNTIF(B3:B7,"Invalid inputs")>0),"Invalid inputs",COUNTIF(B3:B7,"<>OK"))Try the example
Use the original values or change them to test your understanding.