Put this formula in F3:

=IF(B3="","-",B3&"_"&COUNTIF(B$3:B3,B3))

and copy it down beyond your data in order to cope with future expansion - the hyphens will indicate how far you have copied it.

Then you can put this formula in H3:

=IFERROR(INDEX($A:$A,MATCH($G3&"_"&COLUMNS($H:H),$F:$F,0)),"")

and copy it across into I3:L3. Then copy H3:L3 down to row 27.

Hope this helps.

Pete