your example's messing you up... a row of data is just that: each element is related to the others. grabbing a value from another row? why?
if you substitute names for your numbers, you'll see why it doesn't seem right:
col1 col2 col3
George Washington Virginia --5 3 8
Abraham Lincoln Illinois --6 2 9
Bill Clinton Arkansas -- 7 1 10
would you really want:
col1 col2 col3
George Clinton Virginia --5 1 8
Abraham Lincoln Illinois --6 2 9
Bill Washington Arkansas --7 3 10
show us the REAL code(not the pseudo code you tried to show as an example) so we can really help you.
Lowell