Is there any program which would order the data from sheet two as shown on sheet one? i.e. I need to order data from two columns into rows placing the most recent value into sheet 1 in the left hand column of the row.

(sheet 2)
A 1 B 5
B 3 A 2
A 3 B 1

Producing the table:
(sheet 1)

A 3 2 1
B 1 3 5

Thanks,

Phil