Hi,

I am new to VBA and Macros and I need some help editing a datafile. I have a spreadsheet (Sheet2) that looks like this (Start Date is entered in J2 in Sheet 1 and End Date in J3 in Sheet1):

Date & Time Patient ID Result Level
13/02/2014 14:18 1 8.5 >=4 AND <=15
13/02/2014 14:10 2 7.8 >=4 AND <=15
13/02/2014 02:23 11 22.5 >20
13/02/2014 06:19 11 16 >15 AND <=20
13/02/2014 10:08 11 10.2 >=4 AND <=15
13/02/2014 14:11 11 13.4 >=4 AND <=15
13/02/2014 17:54 11 12.9 >=4 AND <=15
13/02/2014 22:24 11 16.6 >15 AND <=20
14/02/2014 06:03 11 12.2 >=4 AND <=15
14/02/2014 09:57 11 8.8 >=4 AND <=15
14/02/2014 22:04 19 8.7 >=4 AND <=15
13/02/2014 16:31 52 4.8 >=4 AND <=15
14/02/2014 11:56 52 7.9 >=4 AND <=15
15/02/2014 12:42 52 5.6 >=4 AND <=15
14/02/2014 12:23 33 9 >=4 AND <=15


I need to find the maximum and minimum value for each subject. If the min>4 and max<10 and the subject does not have a value on either the last date (J3 in Sheet 1) or the date before that (J2 in Sheet 1 - 1), I need all of their data removed from the spreadsheet. Any help would be greatly appreciated.

Thanks,
J.