Sub test()
Dim sortedList As Object
Set sortedList = CreateObject("System.Collections.SortedList")
Dim DataArray(1 To 5, 1 To 3) As String
' Assign values to the array
' Assign values to the array
DataArray(1, 1) = "21/06/2018"
DataArray(1, 2) = "Bernard"
DataArray(1, 3) = "NOM1"
DataArray(2, 1) = "15/08/2020"
DataArray(2, 2) = "André"
DataArray(2, 3) = "NOM2"
DataArray(3, 1) = "10/10/2022"
DataArray(3, 2) = "Emile"
DataArray(3, 3) = "NOM3"
DataArray(4, 1) = "24/08/2024"
DataArray(4, 2) = "Bernard"
DataArray(4, 3) = "NOM1"
DataArray(5, 1) = "08/08/2024"
DataArray(5, 2) = "Emile"
DataArray(5, 3) = "NOM3"
For i = 1 To 5
If Not sortedList.contains(DataArray(i, 2) & ";" & DataArray(i, 3)) Then sortedList.Add DataArray(i, 2) & ";" & DataArray(i, 3), CStr(DataArray(i, 1))
If sortedList(DataArray(i, 2) & ";" & DataArray(i, 3)) < DataArray(i, 1) Then sortedList(DataArray(i, 2) & ";" & DataArray(i, 3)) = DataArray(5, 1)
Next
Dim Tb() As String
ReDim Tb(1 To sortedList.Count, 1 To 3)
For i = 1 To sortedList.Count
K = sortedList.getkey(i - 1)
Tb(i, 1) = sortedList(K)
Tb(i, 2) = Split(K, ";")(0)
Tb(i, 3) = Split(K, ";")(1)
Next
Range("A1").Resize(sortedList.Count, 3) = Tb
End Sub