If you are working on a workbook containing confidential data, you need to anonymise your data if you are collaborating with other people. The technique is not really complex but you have to respect the following steps.
The initial document
Imagine you are a journalist and you receive the following file in your mailbox (it's all fake data). In a few months these data will be famously known as the Nicaragua Papers 😉
Before I share the workbook, let's see how we can anonymise the names.
Step 1: Duplicate the anonymise column
Duplicate the column containing the names to the column H for instance.
Step 2: Extract without duplicates
Then, you remove duplicates (Data>Remove Duplicates) to keep only one name.
The result then becomes the following:
Removing duplicates doesn't remove spelling mistakes. As you will have noticed, we still have Jacky Chin twice because the first name is spelled two different ways. It would be tempting to correct the error in the source file but in data analysis, the main rule is to leave the raw data as they are.
Step 3: Add the anonymous code
In the column I, we'll add the code that will replace the original names. We'll just write in the I2 cell NAME001 value.
Then, with the fill-handle, we just have to drag down to automatically increase the series of numbers 😉. The result then becomes.
Step 4: Replace the original names
Now we need to replace the original name in column A by the anonymous code. To do that we'll use the VLOOKUP function.
Let's insert a column close to the original name and write the following formula
$ Signs mean that references will not move. The result is now the following
Step 5: Replace formulas by values
Column B now contains the results of the formula. We must convert these results into values. This is done very easily with a Copy / Paste Special Value
- Select your cells in column B and make a simple copy (Ctrl + C)
- Do not change your selection and select Paste Special menu by clicking the small arrow below the Paste icon.
- In the options, select this icon to make a collage in value
All the formulas of column B have been replaced by their values in the cells.
Step 6: Remove the original name
Now we just have to delete the value in the column A
- Select column A and right-click> Delete
- Select column A and apply the keyboard shortcut Ctrl + -
Don't forget to keep the corresponding table name to reverse the anonymisation. 😉
Step 7: Back to the original data
To restore your data is not difficult. You just have to:
- Switch the column of the name (the code name must be the first column)
- Create one more time the VLOOKUP to return the original name
- Convert the formula in value
- Remove the anonymous name