Okay, your upload is in compatability mode (pre-2007 Excel) so try this:
add a couple of columns after column F (3 at least),In G2:
drag down to bottom of data, then across to column J, this creates helper columns for the following Array Formulas (must be entered using Cntrl+Shift+Enter,not just Enter):
(pre-2007 Excel) in R3:
Drag down (See .sol1)
(2007 & later) in R3:
Again, Must be array entered; Drag down (See .sol2; (Note that I put this formula in column S, Just for reference purposes))
Hope this helps 
EDIT-
The best route is still what Sixthsense and JBeaucaire suggested, arrange it so the data for each subject goes into one column, you could probable avoid "array" formulas altogether then..
Bookmarks