Great Monks
I finally did get the code to give the solution I wanted. It still gives the 'uninitialized value' warnings which i have suppressed, but i now know they come about because of the empty cells in the CSV file being used in a calculation. These I will deal with eventually.