Tabellab

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — $9.90
Loading the spreadsheet…

Why every privacy project starts with one boring question

Somebody asks you for "just the survey data, without the names". A research partner wants to study asthma and doctor visits, a vendor needs realistic test data, or a colleague in another department wants to build a dashboard. Deleting the name column feels like enough. It almost never is. The person who is left in the file can still be the only 37-year-old female teacher in ZIP code 80331, and anybody who knows that one fact about her now also knows her diagnosis.

This free first lesson is for analysts, researchers, data stewards, HR and finance teams, and anyone else who shares spreadsheets that contain information about people. It teaches the first step of every anonymisation project, and the step people skip most often: going through the columns one by one and deciding what kind of risk each column carries. Once you can tell a direct identifier from a quasi-identifier and a sensitive attribute, every later technique (pseudonyms, age bands, k-anonymity, suppression) has a clear target.

We use the same fictional dataset as the lab above, the Larkfield Community Health Survey, with twelve columns from full name to satisfaction score. All names and values are synthetic. The course teaches techniques, it is educational and not legal advice, and the person who decides what applies to your organisation is your data protection officer or legal counsel.

The core concept: three kinds of columns

Ask one question of every column: could this value, alone or together with others, point to a specific person? The answer sorts the columns into three groups, plus a fourth for everything else.

  • Direct identifiers identify a person on their own: full name, email address, phone number, a patient, customer or employee number, a national ID, an exact street address. You remove them or replace them with a pseudonym before the data leaves the team that collected it.
  • Quasi-identifiers are harmless alone and identifying in combination: date of birth, gender, ZIP code, occupation, marital status, sometimes nationality or job title. Thousands of people share your birth year, but very few share your birth date, your gender and your ZIP code at the same time. These are the columns that later techniques make less precise.
  • Sensitive attributes are the information that must not be linked to a person: a diagnosis, a salary, a disciplinary record, a political or religious view. They are usually the reason for the analysis, so you keep them and protect them indirectly, by making sure nobody can find out which row belongs to whom.
  • Other columns carry little linkage risk in this dataset, for example a satisfaction score or the number of visits. "Other" is a judgement, not a guarantee: a rare value can still stand out, and you revisit the decision when the data or the audience changes.

Why does the distinction matter so much? Because the protections are different. Direct identifiers are handled by deletion or pseudonymisation. Quasi-identifiers are handled by generalisation and suppression, measured with k-anonymity. Sensitive attributes are checked with l-diversity, so that a group of look-alike records does not all share the same secret. If a column is put in the wrong group, it gets the wrong protection, and the release fails quietly.

The well-known result behind this is quoted in the lab theory: Latanya Sweeney estimated that about 87% of the US population was unique by 5-digit ZIP code, gender and full date of birth. Later public cases made the point again. In 2006 AOL published "anonymised" search logs that journalists traced back to individual users, and in 2008 researchers showed that parts of the Netflix Prize ratings could be linked to public movie reviews. In each case the obvious identifiers were gone. The combination of the remaining columns was the problem.

Larkfield survey: 12 columns by type0123456Number of columnsDirect identifiers4Quasi-identifiers5Sensitive attributes1Other2
The 12 columns of the Larkfield survey after classification: four direct identifiers, five quasi-identifiers, one sensitive attribute and two other columns. The five quasi-identifiers are the number the lab asks you to count in C15.

Worked example: classifying the Larkfield survey

Here is the complete classification for the lab sheet, with a one-line reason for every decision. In the lab, column C already contains most answers. You fill in the three missing ones (C3, C8 and C11) and count the quasi-identifiers in C15.

The Larkfield Community Health Survey columns (fictional) and their classification, as in the lab above
RowAttributeExample valueTypeWhy
2Full nameMaria OkaforDirectNames one person on its own
3Email addressm.okafor@example.comDirect (task C3)An inbox belongs to one person
4Phone number+1 555 0142DirectReaches one person or household
5Patient numberLH-20417DirectInternal ID, still points to one patient
6Date of birth14 Mar 1987QuasiShared by many, identifying in combination
7GenderFemaleQuasiSplits every group roughly in half
8ZIP code80331Quasi (task C8)Location, linkable to public lists
9OccupationTeacherQuasiRare jobs narrow a group fast
10Marital statusMarriedQuasiOften known to neighbours and colleagues
11DiagnosisAsthmaSensitive (task C11)The secret the release must protect
12Visits last year2OtherAnalysis variable, low linkage risk here
13Satisfaction score (1-10)8OtherOpinion score, not identifying here

The count in C15 uses =COUNTIF(C2:C13,"Quasi*"). The asterisk is a wildcard for "any text", so the formula counts "Quasi" as well as "Quasi-identifier" or "Quasi ID", whichever spelling a colleague used. For the survey the result is 5: date of birth, gender, ZIP code, occupation and marital status. That number is not trivia. The more quasi-identifiers a release contains, the more combinations exist and the more people become unique, which is exactly what the next example shows.

Two decisions in the table are worth a closer look. The patient number LH-20417 looks harmless because outsiders cannot read it, but inside the clinic it leads straight to one file. Internal IDs are direct identifiers. And the satisfaction score is "Other" only for this audience: if the survey also contained free-text comments, those would need their own review, because people often write their own names, their doctor's name or their street into comment boxes.

How fast combinations become unique

To see why quasi-identifiers matter, take a small fictional extract of twelve respondents with three quasi-identifiers (ZIP, gender, birth year) and one sensitive attribute (diagnosis). For each row we count how many rows share the same values. In Excel the counts in columns F, G and H come from COUNTIFS with absolute ranges:

  • F2: =COUNTIF($B$2:$B$13,B2) (same ZIP)
  • G2: =COUNTIFS($B$2:$B$13,B2,$C$2:$C$13,C2) (same ZIP and gender)
  • H2: =COUNTIFS($B$2:$B$13,B2,$C$2:$C$13,C2,$D$2:$D$13,D2) (same ZIP, gender and birth year)
  • Unique respondents: =COUNTIF(H2:H13,1), and the same for F and G

Fictional 12-respondent extract: how many respondents share each combination (formulas in F, G and H; row 1 holds headers)
IDZIPGenderBirth yearDiagnosisSame ZIPSame ZIP + genderSame ZIP + gender + year
R0180331F1987Asthma421
R0280331F1990Diabetes421
R0380331M1987Asthma421
R0480331M1975Hypertension421
R0580333F1987Migraine422
R0680333F1987Asthma422
R0780333M1962Diabetes421
R0880333M1990Asthma421
R0980335F1975Hypertension431
R1080335F1981Migraine432
R1180335M1962Asthma411
R1280335F1981Diabetes432

By ZIP code alone nobody is unique: every ZIP has four respondents. Add gender and one person stands out (R11, the only man in 80335). Add birth year and 8 of 12 respondents are unique. Anybody who knows that their 1962-born male neighbour in 80335 took part now knows his diagnosis. The data contains no names at all, and still most rows are effectively named. Now imagine full date of birth instead of birth year, plus occupation and marital status, as in the Larkfield survey. With five quasi-identifiers almost every record of a small survey is unique.

Unique respondents out of 12 (fictional extract)048120 of 12ZIP only1 of 12ZIP + gender8 of 12ZIP + gender + birth yearA record is unique when its combination of quasi-identifiers occurs once.
Fictional extract of 12 respondents: unique records rise from 0 (ZIP only) to 1 (ZIP and gender) to 8 (ZIP, gender and birth year). Every quasi-identifier you add multiplies the number of possible combinations.

The count in column H is already the k of each record, the size of its equivalence class. A count of 1 means the record is unique. Lesson 4 of this course builds exactly this column for the whole release and reads the minimum as the k of the dataset.

How to do it in Excel, step by step

  1. Make an inventory sheet. Insert a new sheet (Shift+F11) called "Inventory". In column A list every column header of the dataset. A quick way: select the header row, copy it, then Home → Paste → Paste Special → Transpose to turn the row into a column.
  2. Add an example value. In column B copy one real-looking value per column, from a synthetic or test record if possible. Seeing "m.okafor@example.com" makes the decision obvious in a way that the header "contact" does not.
  3. Restrict the Type column. Select C2:C13 and open Data → Data Validation. Choose Allow: List and type the source Direct,Quasi,Sensitive,Other. Now every cell has a drop-down (open it with Alt+↓) and nobody can type "maybe".
  4. Classify every row. Ask the question for each column: alone, does it point to a person? Then Direct. In combination? Then Quasi. Is it the secret? Then Sensitive. Otherwise Other. Write the reason in column D; you will need it when someone asks later.
  5. Count the groups. In C15 type =COUNTIF(C2:C13,"Quasi*"). Add the same for the other types, for example =COUNTIF(C2:C13,"Direct*"), and a completeness check =COUNTA(C2:C13), which must equal the number of columns (12).
  6. Make it visible. Select C2:C13 and use Home → Conditional Formatting → Highlight Cells Rules → Text that Contains with "Direct" to colour the columns that must be removed first. A second rule for "Quasi" marks the columns that the next steps will generalise.
  7. Test the combinations on the data itself. On the data sheet, add a helper column with COUNTIFS over all quasi-identifiers, as in the extract above, and count the 1s. That single number tells you how many records are unique before you have changed anything.
  8. Freeze the decision. Turn the inventory into a table with Ctrl+T, add the date and your name, and keep it with the dataset. When the data or the audience changes, you review the table, not your memory.

Spreadsheet inventory of survey columns classified as direct identifiers, quasi-identifiers and sensitive attributes
The lab works on a column inventory like this one: one row per attribute, an example value and a type that drives every later privacy step.

From raw extract to a safer release1 Classifycolumns2 Pseudonymisedirect IDs3 Generaliseage, ZIP4 Measurek and l5 Suppresssmall classes6 Reportrisk 1/k7 Minimiseand retainThis free lesson is step 1. Steps 2 to 7 are covered in the paid labs.
The seven steps of this course as one workflow. Classification comes first because every later technique works on one of the three column groups.

Pseudonymised is not anonymous

A common belief is that replacing names with codes makes data anonymous. Under the EU GDPR it does not. The regulation defines pseudonymisation (Article 4(5)) as processing that means data can no longer be attributed to a person without additional information, kept separately. Pseudonymised data is still personal data, because the key exists somewhere. Data counts as anonymous only when a person is no longer identifiable by means reasonably likely to be used (Recital 26), and quasi-identifiers are exactly such means.

In the United States, the HIPAA Privacy Rule for health data offers a "Safe Harbor" method that lists 18 types of identifiers to remove, among them names, small geographic units, all elements of dates except the year, and phone numbers. Notice that dates of birth and ZIP codes are on that list: the rule itself treats some quasi-identifiers like direct identifiers. Other countries have their own rules. The method in this course works the same everywhere: classify, then treat each group with the right technique, then measure what is left.

This lesson classifies columns for a specific release. The same column can move between groups. A job title is "Other" in a dataset of 50,000 employees but a quasi-identifier in a team of eight, where "Head of Legal" names one person. Always classify with the audience and the size of the data in mind.

Common mistakes and how to spot them

  • Calling internal IDs harmless. Customer, patient and employee numbers are direct identifiers for everyone who has access to the source system. Spot it: if a colleague could paste the value into a search box and find one person, it is Direct.
  • Treating dates as one thing. A full date of birth is far more identifying than a birth year, and an admission date can be as revealing as a birth date. Spot it: list every date column separately and ask how precise it needs to be.
  • Forgetting free text and file names. Comment fields, scanned file names and email subject lines often contain names. Spot it: filter text columns for capital letters followed by lowercase words, or simply read a sample of 50 rows.
  • Counting with an exact match. =COUNTIF(C2:C13,"Quasi") misses "Quasi-identifier" and "quasi " with a trailing space. Spot it: compare the sum of all type counts with =COUNTA(C2:C13). If they differ, a label is spelled differently. The wildcard version "Quasi*" is safer.
  • Removing the sensitive attribute. Deleting the diagnosis makes the file safe and useless. The goal is to keep what the analysis needs and protect it, so Sensitive columns usually stay.
  • Classifying once and never again. A new column added next quarter, a smaller audience or a public dataset that can be linked changes the risk. Spot it: date the inventory and review it with every new release.

Quick reference: functions and shortcuts

Quick reference: Excel functions and shortcuts used in this lesson
Function or shortcutWhat it does hereExample
COUNTIF(range, criteria)Counts cells that match one condition, wildcards allowed=COUNTIF(C2:C13,"Quasi*") returns 5
COUNTIFS(r1, c1, r2, c2, …)Counts rows that match several conditions at once=COUNTIFS($B$2:$B$13,B2,$C$2:$C$13,C2)
Wildcard * and ?* = any text, ? = one character"Quasi*" also counts "Quasi-identifier"
COUNTA(range)Counts non-empty cells, for a completeness check=COUNTA(C2:C13) should be 12
COUNTIF(F2:F13,1)Counts the respondents whose combination is uniqueReturns 8 for ZIP + gender + year
Data → Data Validation → ListRestricts the Type column to four allowed wordsSource: Direct,Quasi,Sensitive,Other
Alt+↓Opens the drop-down list in a validated cellPick "Quasi" without typing
F4Toggles absolute references while editing a formulaB2:B13 → $B$2:$B$13
Ctrl+Shift+LTurns the filter arrows on or offFilter the inventory by type
Home → Conditional Formatting → Highlight Cells RulesColours cells equal to a valueHighlight every count equal to 1

Real-world uses

  • Research data sharing. A hospital or a city health office sends survey data to a university. The column inventory is the first page of the data sharing agreement and shows exactly which columns were removed, which were coarsened and which stayed.
  • HR analytics. A pay-gap analysis needs salary (sensitive), gender, grade and department (quasi-identifiers). In a small department, the inventory shows immediately that department and grade together may point to one person, so results are reported only for larger groups.
  • Test data for software projects. Developers need realistic data. The inventory tells you which columns to replace with synthetic values (all direct identifiers) and which to shuffle or coarsen before a copy of production data ends up on a test server.
  • Customer analytics for marketing. A vendor builds a churn model from your customer table. You keep purchase history, remove names and emails, and generalise ZIP codes to regions because the model does not need street level precision.
  • Answering an access or deletion request. When a person asks what data you hold about them, the inventory lists which columns in which file can identify them, so you can find and answer faster.

What you will build in the rest of this course

This first lab is free. The remaining 19 labs belong to the full course, a one-time purchase of $9.90, and they take the Larkfield survey from a column list all the way to a release you can defend.

Pseudonymisation: Lookup Keys, Salted IDs & Masking. You replace the names of ten customers with pseudonyms from a separate key table, build an illustrative salted ID and mask email addresses, and you see for yourself why whoever holds the key table can still re-identify everyone.

Generalisation: Age Bands & ZIP Prefixes. You coarsen age into 10-year bands and ZIP codes into 3-digit areas with formulas, then count how many of 20 records are still unique, the same check as in the extract above, but with the cure applied.

k-Anonymity: Equivalence Classes with COUNTIFS. You build the class size of every record with COUNTIFS, read the k of the release and test it against a target of k = 3.

Suppression of Small Classes & Information Loss. You remove the records in classes that are too small, measure how much data that costs and check whether the statistic the researchers care about is now biased.

l-Diversity: When Everyone in a Class Shares the Secret. A class of three identical-looking records is not safe if all three have the same diagnosis. You count distinct diagnoses per class and find the l of the release.

Re-identification Risk: 1/k, Average & Maximum Risk. You turn class sizes into risk figures, report the maximum and the average risk the way risk assessments do, and chart the risk by class.

Data Minimisation & Retention: Which Rows Must Go? You apply a retention schedule to twelve records with lookups and EDATE and flag every row that is due for deletion on the review date.

Summary

Every anonymisation project starts with a column inventory. Direct identifiers point to a person on their own and are removed or pseudonymised. Quasi-identifiers point to a person in combination and are generalised and measured with k-anonymity. Sensitive attributes are what must not be linked to anyone, and they usually stay. A simple COUNTIF with a wildcard counts the groups, and a COUNTIFS helper column on the data shows how many records are unique before you change anything.

Now scroll up to the lab and classify the email address, the ZIP code and the diagnosis, then count the quasi-identifiers in C15. It takes about ten minutes, the Coach checks each cell as you type, and you will look at every dataset you share a little differently afterwards.

Frequently asked questions

What is the difference between a direct identifier and a quasi-identifier?

A direct identifier such as a name, email address or patient number identifies a person on its own. A quasi-identifier such as date of birth, gender or ZIP code is shared by many people but can identify someone when combined with other quasi-identifiers.

Is pseudonymised data anonymous under the GDPR?

No. Under the GDPR pseudonymised data is still personal data, because the key that links the pseudonym to the person still exists. Data is anonymous only when a person is no longer identifiable by means reasonably likely to be used.

What counts as a sensitive attribute in a dataset?

A sensitive attribute is the information that must not be linked to a person, for example a diagnosis, a salary or a disciplinary record. It is usually kept for the analysis and protected by making the quasi-identifiers less precise.

How do I find unique records in Excel?

Add a helper column with COUNTIFS over all quasi-identifier columns, for example =COUNTIFS($B$2:$B$13,B2,$C$2:$C$13,C2,$D$2:$D$13,D2). A result of 1 means the record is unique, and =COUNTIF(H2:H13,1) counts how many there are.

Is removing names enough to anonymise a spreadsheet?

Usually not. The remaining quasi-identifiers such as birth date, gender and ZIP code often make individual rows unique, so a person can be recognised without a name. They need to be generalised or suppressed as well.

Why does COUNTIF use "Quasi*" with an asterisk?

The asterisk is a wildcard for any text, so the formula counts "Quasi", "Quasi-identifier" and similar spellings. An exact match would silently miss labels that a colleague typed differently.

Keep going: Data Privacy in Practice: Pseudonymisation, k-Anonymity & Re-identification Risk

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time $9.90.

  1. Pseudonymisation: Lookup Keys, Salted IDs & Masking
  2. Generalisation: Age Bands & ZIP Prefixes
  3. k-Anonymity: Equivalence Classes with COUNTIFS
  4. Suppression of Small Classes & Information Loss
  5. l-Diversity: When Everyone in a Class Shares the Secret
  6. Re-identification Risk: 1/k, Average & Maximum Risk
  7. Data Minimisation & Retention: Which Rows Must Go?
  8. t-Closeness: How Far a Class Drifts from the Overall Mix
  9. Small Cells in Published Tables: Primary & Secondary Suppression
  10. Rounding Counts to Base 5 & the Additivity Problem
  11. Top-Coding Outliers: Capping Age & Income
  12. Noise Addition: Perturbing Values and Measuring the Bias
  13. Differential Privacy: The Laplace Mechanism for Counts
  14. Privacy Budget Ledger: Adding Up Epsilon across Queries
  15. Linkage Attack: Matching a Release against a Public List
  16. Date Shifting: Hiding Exact Dates but Keeping Intervals
  17. Measuring Utility: Average Class Size & Discernibility
  18. Choosing the Generalisation Level: Five Options Compared
  19. Final Project: Release Readiness Check for a Staff Survey

Buy course — $9.90 See the full course