In the original data set, the household ID (HH_ID) was built from the subarea code (cluster), street (Blok) and house number (No). To protect personal data of observed households, the HH_ID was anonymised using a VBA Code which is described below. Note: Information of proximity effects / spatial dependency analysis was lost with anonymisation. ---------------------------------------------------------------- Documentation for the "Renumber" VBA Macro Objective: Anonymizing Data in Column HH_id Overview: The "Renumber" VBA macro is designed to anonymize data in a specific column (HH_ID) of an Excel worksheet. The macro assigns unique identifiers (group numbers) to groups of identical values in column "HH_ID", thereby anonymizing the data while preserving its original structure. How it Works: Initialization: The macro initializes variables and creates a dictionary object (GroupNumbers) to store unique values encountered in the respective column and their corresponding group numbers. Identifying Groups: It iterates through each cell in the column, starting from the second row, to identify groups of identical values. Assigning Group Numbers: If a value is encountered for the first time, it is added to the dictionary (GroupNumbers) with a unique group number. Subsequent occurrences of the same value are assigned the same group number. Anonymization: The original values in the respective column are replaced with their corresponding group numbers, effectively anonymizing the data. Example: Consider a dataset where the respective column contains the following values: Column --- A B A C B After running the "Renumber" macro, the anonymized data in the column would appear as follows: Column --- 1 2 1 3 2 Here, values "A" and "B" are assigned group numbers 1 and 2, respectively, while value "C" is assigned group number 3. --------- Code: Sub Renumber() Dim LastRow As Long, i As Long Dim GroupNumber As Long Dim Value As Variant Dim GroupNumbers As Object Set GroupNumbers = CreateObject("Scripting.Dictionary") LastRow = Cells(Rows.Count, 23).End(xlUp).Row ' Find the last used row in column W For i = 2 To LastRow Value = Cells(i, 23).Value ' Get the value of the current cell in column W If Not GroupNumbers.Exists(Value) Then ' If the value is not already in the dictionary GroupNumber = GroupNumbers.Count + 1 ' Increment the group number GroupNumbers.Add Value, GroupNumber ' Add the value to the dictionary with the corresponding group number End If Cells(i, 23).Value = GroupNumbers(Value) ' Assign the group number to the current cell Next i End Sub [code created with assistance of ChatGPT3.5]