try this macro with a small extract of data e.g. given below
h1 h2 h3 h4
61 45 36 a
49 37 30 s
2 78 85 d
26 74 17 s
84 82 53 a
81 8 36 s
22 28 40 d

replace column D that a,s,d etc by your names

the macro should be copied in module of this workbook

if this is successful you can try with the original data. But I am afraid it will take time
you can modify it if you like.

I am not able to check the macro completely