May I suggest that your data field for the time should be formatted to show AM or PM, otherwise you won't know if a surgery occurred at 1:00 AM or 1:00 PM. After you format the time you can figure out the correct order for each surgeon within each date.
Now the difficult part-can the list be sorted? If not, then my opinion is that VBA code is needed to examine the activity for each name listed to identify the surgeon's first surgery for the day.
I formatted your time field, sorted the list by surgeon, date, time, added a couple more lines to test my formula, and came up with this:
Doctor Date Time First?
Blue 7/1/2011 11:00 AM FIRST
Blue 7/3/2011 1:00 AM FIRST
Gray 7/1/2011 11:00 AM FIRST
Gray 7/1/2011 12:00 PM
Gray 7/1/2011 1:30 PM
Gray 7/3/2011 12:00 PM FIRST
Red 7/2/2011 11:00 AM FIRST
Red 7/3/2011 12:00 PM FIRST
Code:
=IF((A2&B2=A3&B3)*(A2<>A1)+((A2&B2<>A1&B1)*(A2&B2<>A3&B3)),"FIRST","")
Formula interpretation: (If name AND date EQUALS name AND date in the row below, AND name DOES NOT EQUAL name above) OR (name AND date DOES NOT EQUAL name above AND name AND date DOES NOT EQUAL name below) THEN "FIRST", OTHERWISE ""
The formula can be shortened a bit. In a sorted list if the name does not equal the name above, then this would be the first surgery. The revised code:
Code:
=IF((A2<>A1)+((A2&B2<>A1&B1)*(A2&B2<>A3&B3)),"FIRST","")