This is the hands-on companion to the broader catalog work we laid out in Bookstore inventory taxonomy: stop edition chaos, dedupe ISBNs and govern your catalog. That piece covers why edition chaos happens. This one is the cookbook — the actual rules, formulas, SKU patterns, and SQL you tape to the wall next to the receiving desk.
The scope here is narrow on purpose. One problem: the same physical book existing two, three, sometimes five times in your system under slightly different ISBNs, formats, or vendor feeds. Every duplicate hides stock, breaks your marketplace quantity, and makes your reorder math lie to you.
Start with the one distinction most catalogs get wrong
Before any formula, your data model needs three separate concepts that teams constantly smash into one field:
-
masterworkid — the work (e.g. "Dune by Frank Herbert"). One per intellectual work, regardless of format or printing.
-
product SKU — the thing you sell and count (the 2019 Ace mass-market paperback, specifically). One per edition/format/condition.
-
ISBN — an identifier attached to a product, not the product itself. A product can carry more than one historically valid ISBN; some products (sidelines, used books with torn covers, imports) have none.
When these three get collapsed into a single "ISBN" column, duplicates become unavoidable. The hardcover and paperback of the same title look unrelated. The same paperback from two distributors looks like two books. That's the root of almost every dedupe headache.
Here's a sample row set showing the separation, including an MFN (merchant-fulfilled) vs marketplace quantity split:
``csv
masterworkid,productsku,isbn13,isbn10,format,condition,mfnqty,marketplaceqty,totalonhand
MW-000418,BK-9780441013593-NEW,9780441013593,0441013597,masspaperback,new,6,4,10
MW-000418,BK-9780441172719-NEW,9780441172719,0441172717,tradepaperback,new,3,2,5
MW-000418,BK-9780441172719-USEDG,9780441172719,0441172717,tradepaperback,used_good,2,0,2
MW-000418,BK-9780593099322-NEW,9780593099322,0593099322,hardcover,new,1,1,2
MW-001207,SKU-TOTE-DUNE-01,,,sideline,new,14,0,14
``
Notice MW-000418 ties four distinct sellable SKUs to the same work. The used trade paperback shares an ISBN with the new one but is a different product — different condition, different price, different shelf. And the Dune tote bag has no ISBN at all, so it gets a deterministic internal SKU, which we'll cover below.
The 8 governance rules (print this page)
These are the rules the whole team enforces. Each has a name, a one-line reason, and a concrete action so there's no debate at the receiving desk.
Never miss a sale or stock shortage again.
Bookstorely helps you manage inventory, orders, and customer relationships seamlessly.
- Integrated inventory tracking
- Customer purchase history
- Sales reporting & analytics
No credit card required
| # | Rule | Why it matters | Enforcement / action |
|---|---|---|---|
| 1 | ISBN-13 is the canonical key | ISBN-10 is legacy; feeds mix both and cause phantom duplicates | Normalize every inbound ISBN to ISBN-13 on import; store original in raw_isbn |
| 2 | One product SKU per edition + condition | Mixing new/used under one SKU corrupts counts and pricing | New and used of the same ISBN get separate SKUs with a condition suffix |
| 3 | Every SKU maps to exactly one masterworkid | Lets you group formats without merging counts | Assign or reuse masterworkid at intake; never leave it blank |
| 4 | No ISBN = deterministic internal SKU, never blank | Blank identifiers collide and silently overwrite | Generate SKU from a fixed template (see below); never auto-assign a random one |
| 5 | Strip and validate before compare | Hyphens, spaces, and bad check digits create false mismatches | Run normalization formula on every ISBN column before any dedupe pass |
| 6 | Match status is mandatory on every import row | You can't triage what isn't labeled | Each imported row gets match_status: exact, probable, review, or new |
| 7 | Merges are reversible and logged | A bad merge can bury real stock | Keep a merge_log with old IDs, new ID, timestamp, operator, reason |
| 8 | Quarantine beats guessing | Forcing a match on ambiguous data is worse than holding it | Anything below the fuzzy threshold goes to a quarantine queue, not into live inventory |
Rule 7 is the one teams skip and regret. A merge that collapses two SKUs looks fine until you realize one of them had 8 units on a marketplace listing that just disappeared. Reversibility isn't optional.
Copy-paste formulas: normalization and dedupe
These are written for Google Sheets; Excel equivalents noted where they differ. Assume raw ISBN is in column A.
1. Strip everything but digits and X
``
=UPPER(REGEXREPLACE(TO_TEXT(A2),"[^0-9Xx]",""))
``
Excel (365): =UPPER(TEXTJOIN("",TRUE,IFERROR(MID(A2,SEQUENCE(LEN(A2)),1),""))) is messier — most teams just use Power Query's "replace using pattern" or a short formula. In Sheets, REGEXREPLACE is the clean path.
2. Flag whether it's a 10 or 13 and whether length is valid
``
=IF(LEN(B2)=13,"ISBN13",IF(LEN(B2)=10,"ISBN10","INVALID_LEN"))
`
(B2` = the cleaned value from formula 1.)
3. ISBN-10 → ISBN-13 (the actual transform)
An ISBN-10 becomes ISBN-13 by prefixing 978, dropping the old check digit, and recomputing a new one. Here's the full Sheets formula taking cleaned ISBN-10 from B2:
``
=IF(LEN(B2)<>10,"",
LET(core,"978"&LEFT(B2,9),
chk,MOD(10-MOD(
SUMPRODUCT(
MID(core,SEQUENCE(1,12),1)*1,
IF(ISEVEN(SEQUENCE(1,12)),3,1)
),10),10),
core&IF(chk=10,0,chk)))
``
If your Sheets version doesn't support LET/SEQUENCE, there's a longhand version, but the cleaner move for most people is to compute it once per unique ISBN-10 in a helper column, then paste-values. You don't want this recalculating live across 1,500 rows.
A worked check: ISBN-10 0441013597 → prefix gives 978044101359 → compute check digit → 9780441013593. If your formula returns anything else, the digit-stripping step left a stray character somewhere.
> Reference note: The exact conversion and check-digit algorithm are published by the International ISBN Agency. For how these identifiers flow through product metadata feeds, see the ONIX standard maintained by EDItEUR, and BISG's product-data best practices for US book trade conventions.
4. Dedupe hash (the comparison key)
Build one string that represents "the same sellable product." Include ISBN-13, format, and condition so you don't accidentally merge new and used:
``
=LOWER(C2&"|"&TRIM(D2)&"|"&TRIM(E2))
`
Where C2 = normalized ISBN-13, D2 = format, E2 = condition. For non-ISBN items, C2 is the internal SKU instead. This hash is what you COUNTIF` against.
5. COUNTIF duplicate flag
``
=IF(COUNTIF($F$2:$F2,F2)>1,"DUPLICATE","")
`
The expanding range $F$2:$F2` flags the second and later occurrences, leaving the first instance as the keeper. Sort by this column and duplicates group together immediately.
6. Quick "needs review" flag for missing keys
``
=IF(OR(B2="",C2="INVALID_LEN"),"REVIEW","")
``
SKU templates for non-ISBN items
Rule 4 says never leave a blank identifier. The problem with letting your POS auto-generate SKUs for sidelines, used books with no barcode, consignment, or imports is that they're opaque and collide across systems. A deterministic template fixes that — anyone can read the SKU and know what it is.
Use a fixed prefix + category + short slug + sequence:
``
SKU-{CATEGORY}-{SLUG}-{NN}
``
-
SKU-TOTE-DUNE-01— a Dune tote bag -
SKU-USED-HERBERTDUNE-TPB-G— used trade paperback, no scannable barcode, graded Good -
SKU-CONSIGN-LOCALPOET-ROOTS-01— consignment title from a local author -
SKU-IMPORT-UKED-MIDDLEMARCH-01— UK import edition with a non-US ISBN you don't want colliding
Rules for the template:
-
Category codes are a closed list (TOTE, USED, CONSIGN, IMPORT, CARD, GAME…). Don't invent new ones at the desk.
-
Slug is uppercase, no spaces, author+short-title — enough to be human-readable.
-
The trailing sequence handles genuine variants (two different Dune totes).
-
Once assigned, a SKU never changes, even if you later find an ISBN for it. Add the ISBN as metadata instead.
The payoff: when two staff members both intake "that local poetry chapbook" three weeks apart, the deterministic slug makes the collision visible instead of silently creating a second SKU.
The tiered matching cascade
This is the core of the dedupe process. When a new import row arrives, you run it down a cascade — most reliable match first, fuzziest last. Each tier has a confidence level and a triage action.
``
[Inbound import row]
|
v
Tier 1: Exact ISBN-13 + format + condition match?
|-- YES --> matchstatus = exact --> auto-merge qty
|-- NO --> next tier
v
Tier 2: ISBN-10 converts to matching ISBN-13?
|-- YES --> matchstatus = exact (log conversion) --> merge
|-- NO --> next tier
v
Tier 3: UPC/EAN matches stored barcode?
|-- YES + format match --> matchstatus = probable --> merge
|-- YES, format mismatch --> send to review
|-- NO --> next tier
v
Tier 4: Title + author + publisher + pub-year all exact?
|-- YES + preapproved --> matchstatus = probable --> merge
|-- YES, not preapproved --> review queue
|-- NO --> next tier
v
Tier 5: Fuzzy title/author similarity above threshold?
|-- >= 0.90 --> match_status = review --> quarantine
|-- < 0.75 --> treat as new record
|-- else --> quarantine
``
A quick visual of this cascade:
Tier 1 — Exact ISBN-13
Normalized ISBN-13 matches an existing product's ISBN-13 and format/condition match.
→ match_status = exact. Merge quantity automatically.
Tier 2 — ISBN-10 resolved to ISBN-13
Inbound ISBN-10 converts to an ISBN-13 that matches.
→ match_status = exact (after conversion). Merge, but log that it came in as ISBN-10.
Tier 3 — UPC / EAN
No ISBN, but a UPC/EAN matches a stored barcode (common on sidelines and some mass-market).
→ match_status = probable. Merge if format also matches; otherwise send to review.
Tier 4 — Exact metadata
No usable barcode. Title + author + publisher + pub-year all match exactly after normalization.
→ match_status = probable. Review queue unless an operator has pre-approved the pairing.
Tier 5 — Fuzzy metadata
Title/author similarity above threshold but not exact.
→ match_status = review. Never auto-merge. Goes to quarantine.
A simple similarity flag in Sheets using normalized title strings (lowercased, punctuation stripped):
``
=IF(EXACT(G2,H2),"EXACT",
IF(LEN(G2)=0,"NO_TITLE",
"FUZZY"))
``
For real fuzzy scoring you'll want Levenshtein or a trigram ratio, which Sheets doesn't do natively — this is where a short Apps Script function or a database function earns its keep. A practical threshold: ≥ 0.90 similarity = probable, 0.75–0.90 = review, < 0.75 = treat as new. Those numbers aren't sacred; tune them after watching a few hundred rows run through. In practice most stores find 0.90 catches reprints-with-subtitle-tweaks without false-merging genuinely different books.
The import/audit column set
Every import file should land in a staging table with these columns before anything touches live inventory. This is what makes problems reviewable instead of mysterious:
-
raw_source— which vendor/feed/file this row came from -
raw_isbn— the untouched inbound value -
rawtitle,rawauthor,raw_publisher— as received -
norm_isbn13— output of your normalization + conversion -
norm_title— lowercased, punctuation-stripped -
matched_sku— the existing SKU this resolved to (blank if new) -
match_tier— 1–5 from the cascade -
match_status— exact / probable / review / new -
review_notes— free text for the operator -
importedat,importedby
The single most useful column here is raw_source. When you later find a batch of bad ISBNs, you can trace them to one distributor feed and fix the import mapping once instead of cleaning 40 rows by hand.
SQL / pseudocode for dedupe and merge
The merge logic below is SQL-ish pseudocode. The exact dialect doesn't matter much — what matters is the order of operations and the logging.
Step 1 — find exact-match duplicate groups:
``sql
SELECT normisbn13, format, condition, COUNT() AS dupes,
MIN(productsku) AS keepersku
FROM products
WHERE normisbn13 IS NOT NULL
GROUP BY norm_isbn13, format, condition
HAVING COUNT() > 1;
``
Step 2 — merge quantities into the keeper, then retire the losers:
``sql
-- roll quantities up to the keeper
UPDATE products p
SET mfnqty = mfnqty + src.mfnqty,
marketplaceqty = marketplaceqty + src.marketplaceqty
FROM (SELECT ... losing rows ...) src
WHERE p.productsku = :keepersku;
-- log before retiring
INSERT INTO mergelog(oldsku, newsku, mergedat, operator, reason)
VALUES (:losersku, :keepersku, NOW(), :operator, 'exactisbn13dupe');
-- retire, don't delete
UPDATE products SET status = 'merged', mergedinto = :keepersku
WHERE productsku = :losersku;
``
Two things worth underlining:
-
Retire, don't delete. Setting
status = 'merged'keeps the trail. If a marketplace order comes in against the old SKU, you can still resolve it. -
Log before you touch quantity. If the merge goes wrong, the
merge_logplus the retired row is your undo button.
In pseudocode, the full import run looks like this:
``
for each row in staging:
normalize isbn -> isbn13
build dedupehash
tier = runcascade(row)
if tier in (1,2): # exact
mergeqty(row, keeper)
logmerge(...)
elif tier in (3,4): # probable
if operatorpreapproved(pair): mergeqty(...)
else: sendtoreview(row)
else: # review/new
quarantine(row)
``
The order matters. Logging before the quantity update isn't just a nice habit — it's the difference between a recoverable mistake and an afternoon of manual counting.
The quarantine and resolve workflow
Rule 8 exists because the worst catalog damage comes from confident wrong merges, not from unmatched rows sitting in a queue. Ambiguous rows staying out of live stock until a human decides is the safer outcome every time.
-
Pull the review queue — everything with
match_statusin (review,probablewithout preapproval). -
For each row, the operator picks one of three actions
- Merge into an existing SKU → triggers the logged merge above. - Create new → generates a new product SKU (or deterministic non-ISBN SKU) and assigns/reuses a
masterworkid. - Hold → stays quarantined with a note (e.g. "waiting on distributor to confirm format"). -
Record the decision in
reviewnotesand stampresolvedby/resolved_at. -
Pre-approve recurring pairs — if the same fuzzy pairing shows up weekly from one feed, approve it once so the cascade auto-merges it next time.
That fourth step is where the queue stops growing. The first month feels like a lot of manual review; by month two or three, the common pairings are pre-approved and you're only looking at genuinely new ambiguity.
A realistic before/after
A general-interest indie running roughly 1,500 active SKUs across their POS, their own webstore, and two marketplaces had the classic symptom: marketplace oversells on titles that "showed in stock." The cause was mundane — their main distributor feed sent ISBN-10 on backlist and ISBN-13 on frontlist, so dozens of backlist titles existed twice with stock split across both records.
-
Around 120–140 duplicate product records out of ~1,500 (just under 10%).
-
Roughly 6–8 oversell cancellations a month on marketplaces, each one a hit to seller metrics and a refund to process.
-
Reorder reports understated on-hand on split titles, so they were reordering books they already had — a few hundred dollars of avoidable buying per cycle.
After running the normalization formulas, the Tier 1–2 cascade, and a two-week quarantine pass on the fuzzy remainder:
-
Duplicates collapsed to under 15 (the stubborn ones were genuine format ambiguity that needed a human call).
-
Oversell cancellations dropped to roughly one a month, usually a true timing race, not a phantom stock issue.
-
Their reorder report finally matched a physical spot-count within a unit or two.
No dramatic revenue turnaround — just the quiet kind of fix where the numbers stop lying and the Monday morning marketplace emails stop.
When this full system makes sense (and when it's overkill)
Worth building the whole cascade if you sell on more than one marketplace, take in used/consignment/sidelines without barcodes, or pull from multiple distributor feeds with inconsistent ISBN formats. That's where duplicates compound fastest.
Probably overkill if you're a single-channel store under a few hundred SKUs with one clean distributor feed. In that case, rules 1, 2, 5, and the normalization formula alone will catch nearly everything. Don't build a quarantine queue you'll never staff.
Who should not DIY the SQL merge — if nobody on the team is comfortable with a database and a merge_log, don't run destructive merges by hand in a spreadsheet. Do the normalization and flagging in Sheets, but handle the actual quantity-rollup inside whatever inventory or operational platform you run, where merges can be logged and reversed. A reversible merge inside a system beats a clever irreversible one in a spreadsheet every time. This is also where AI-assisted matching tends to help most — flagging the fuzzy Tier-5 pairs for a human rather than guessing — but the governance rules above are what make that assistance safe to trust. The tool proposes; your rules and your operator decide.
The thing to actually do this week
Don't try to boil the ocean. Open your product export, add four helper columns — normalized ISBN-13, the 10→13 conversion, the dedupe hash, and the COUNTIF flag — and sort by duplicates. You'll see the scope of the problem in about twenty minutes, and the worst offenders (the split-stock backlist titles) will jump out immediately.
Fix those by hand first, with the merge logged. Then decide whether the fuzzy tier and quarantine queue are worth standing up based on how many ambiguous rows are actually left. Governance isn't about having the most elaborate ruleset — it's about having rules your team will actually follow at the receiving desk at 4pm on a busy Saturday.
For the strategic layer underneath all of this — how your taxonomy and masterworkid structure should be designed in the first place — the companion piece on stopping edition chaos and governing your catalog is the place to start.
Ready to elevate your bookstore’s operations?
Join 500+ bookstores using Bookstorely to boost sales, optimize stock, and delight book lovers.