Sub DictionaryLookup()
Dim dataSheet As Worksheet
Dim outputSheet As Worksheet
Dim dataRange As Range
Dim outputRange As Range
Dim dataArr As Variant
Dim outputArr As Variant
Dim dict As Object
Dim i As Long
' Set the data and output sheets
Set dataSheet = ThisWorkbook.Worksheets("Data")
Set outputSheet = ThisWorkbook.Worksheets("Output")
' Get the data and output ranges
Set dataRange = dataSheet.Range("A2:D" & dataSheet.Cells(dataSheet.Rows.Count, "A").End(xlUp).Row)
Set outputRange = outputSheet.Range("A2:E" & outputSheet.Cells(outputSheet.Rows.Count, "A").End(xlUp).Row)
' Convert the data and output ranges to arrays
dataArr = dataRange.Value
outputArr = outputRange.Value
' Create a dictionary to store the data
Set dict = CreateObject("Scripting.Dictionary")
' Loop through the data array and add the data to the dictionary
For i = 1 To UBound(dataArr, 1)
' Get the key for the dictionary (Name, Class, Fees Start, Fees End)
Dim key As String
key = dataArr(i, 1) & "|" & dataArr(i, 2) & "|" & dataArr(i, 3) & "|" & dataArr(i, 4)
' Add the fees to the dictionary for the key
dict(key) = dataArr(i, 5)
Next i
' Loop through the output array and update the fees column with the dictionary lookup
For i = 1 To UBound(outputArr, 1)
' Get the key for the dictionary lookup
Dim lookupKey As String
lookupKey = outputArr(i, 1) & "|" & outputArr(i, 2) & "|" & outputArr(i, 3) & "|" & outputArr(i, 4)
' Lookup the fees in the dictionary and update the output array
If dict.exists(lookupKey) Then
outputArr(i, 5) = dict(lookupKey)
Else
outputArr(i, 5) = ""
End If
Next i
' Update the output range with the updated output array
outputRange.Value = outputArr
End Sub