In short: A CPR number is a date of birth (DDMMYY) plus four digits. You can search for the pattern, but a plain search misses numbers without a dash, numbers Excel stripped of their leading zero, and text inside PDFs and attachments. The quickest route is to check the file here: it is read in your browser, never uploaded.

Danish CPR number format

Ten digits: date of birth as DDMMYY and a four-digit sequence number, usually written DDMMYY-XXXX. The last digit is even for women and odd for men. The 7th digit, together with the year, tells the century of birth. Since 2007 the CPR Office also issues numbers that fail the old modulus 11 check, so “mod 11 validation” must not be used to reject a number.

Searching in Excel

  • Wildcard search: Ctrl+F, Options, “Within: Workbook”, search ??????-????. This only finds numbers with a dash.
  • Look at headers: “CPR”, “Cpr-nr.”, “Personnummer” or “Fødselsdato” are the fastest clue.
  • Mind the lost zero: in a number-formatted column Excel stores 0101901234 as 101901234, nine digits and no dash, which the search above misses.

To display CPR numbers consistently, format the column as Text before typing, or use a custom number format such as 000000-0000. But first ask whether the column needs the full number at all.

Word and PDF

  • Word: Ctrl+H, More, tick “Use wildcards”, search [0-9]{6}-[0-9]{4}.
  • PDF: search only works if the PDF has a text layer. A scanned PDF is an image; nothing finds text in it without OCR.

Many files at once

Windows and Microsoft 365 search is built for words, not digit patterns with date validation. For a folder of hundreds of files, or all of SharePoint and OneDrive, you need a tool that understands the format, checks that the date exists and looks at context (does “CPR” or “phone” sit next to it?). Our check does that for one file at a time; the M365 version does it for the whole organisation.

Found some?

  1. Should the data be there? Is there a basis under section 11?
  2. If not: delete the column or file, or replace it with a date of birth or ID.
  3. If so: move the file somewhere with restricted access and remove “anyone with the link” sharing.

Sources

  1. CPR: Opbygning af CPR-nummeret (cpr.dk)
  2. CPR: Personnumre uden kontrolciffer (modulus 11-kontrol) (cpr.dk)
  3. Databeskyttelsesloven § 11 (danskelove.dk)
  4. Datatilsynet: Påvisningskrav og dataminimering

Not legal advice: this article is general information and does not replace an assessment of your specific situation. Ask a lawyer or your data protection officer if in doubt.