How to work with 4 sets of data and 2 variables?

torquefreak:
For this reason, though I was able to understand the replies, I'm unable to put this in code.

Only in the short period of time that elapsed since the replies... programming takes time. It would be better for you to study the replies than to sail off with a cut and paste job from another program.