Sorry for the delay in Thanking you for your assistance. I think I have figured out how to get the numbers I need.
The countif function gives me the number of time each exam was performed, not necessarily the number of patients that had both exams in the same visit.
I probably did not explain myself very well and my spreadsheet example was messed up as well.
Below is another example with what I have come up with. (As a note, this is not real data therefore no PHI has been compromised
[pre]
Code:
Pt Exam D/T Exam # f/u D/T initial D/T f/u Initial
ID - - exams exam exam to f/u
1 10/10/08 15:02 AbdPelvis WO 0 10/10/08 15:02 n/a
2 10/10/08 14:15 AbdPelvis WO 0 10/10/08 14:15 n/a
3 10/10/08 18:21 AbdPelvis WO 0 10/10/08 18:21 n/a
4 10/10/08 18:36 AbdPelvis WO 5 10/10/08 18:36 10/21/08 19:12 264:35
4 10/10/08 18:36 Chest WO 4 n/a
4 10/10/08 18:36 Head WO 3 n/a
4 10/16/08 12:45 Head WO 2 n/a
4 10/21/08 19:11 Chest With 1 n/a
4 10/21/08 19:12 AbdPelvis With 0 n/a
[/pre]
Initial exam is AbdPelvis WO, Follow-up Exam is AbdPelvis With
As you can see only 1 patient had an AbdPelvis With following an AbdPelvis WO
You can also see that the number of patients with a f/u exam w/i 12 hours is zero.
To simplify my formulas below, I have replaced the cells referencing the exams by the name of the exams.
Column E returns the D/T of the Initial Exam if it matches the criteria
Formula: =IF(COUNTIF($C2,"AbdPelvis WO")=1,$B2,"")
Column F returns the D/T of the Follow-up Exam if it matches the criteria
Formula:IF($C5="AbdPelvis WO",IF($D5<>0,IF(ISERROR(MATCH("AbdPelvis With",$C5:OFFSET($C5,1,0,$D5,1),0)),"",INDEX($B5:OFFSET($B5,1,0,$D5,1),MATCH("AbdPelvis With",$C5:OFFSET($C5,1,0,$D5,1),0))),""),"")
Column G simply subtracts column F from Column E.
I can use other COUNTIF formulas to give me totals of each column
I have little doubt that there is an easier & faster way to get the same results. Any thoughts are appreciated.
I hope this makes sense.
Thanks again for your help.