Spreadsheet: 86543d1286499165-how-to-calculate-duration-with-first-last-date-and-multiple-dates-in-between-book9
Sheet: Sheet1

ApptDate | patientID | STATUS | VisitType | doctorID |  | patientID | First | Last | Days
2009-06-03 00:00:00 | 1000032338 | CHK - Checked-out | MH-IND | 9110 |  | 1000032338 | 2009-06-03 00:00:00 | 2009-06-03 00:00:00 | 1
2008-09-23 00:00:00 | 1000030692 | CHK - Checked-out | MH-IND | 9114 |  | 1000030692 | 2008-09-23 00:00:00 | 2009-03-27 00:00:00 | 186
2009-03-27 00:00:00 | 1000030692 | CHK - Checked-out | MH-IND | 9108 |  | 1000031359 | 2008-11-12 00:00:00 | 2008-11-12 00:00:00 | 1
2008-11-12 00:00:00 | 1000031359 | CHK - Checked-out | MH-IND | 9115 |  | 1000017540 | 2008-08-01 00:00:00 | 2009-07-23 00:00:00 | 357
2008-08-01 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000017117 | 2008-05-09 00:00:00 | 2009-12-14 00:00:00 | 585
2008-09-16 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000032692 | 2010-02-24 00:00:00 | 2010-02-24 00:00:00 | 1
2008-12-11 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000031090 | 2009-02-25 00:00:00 | 2009-02-25 00:00:00 | 1
2009-03-11 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000030217 | 2008-05-08 00:00:00 | 2008-05-08 00:00:00 | 1
2009-05-12 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000030873 | 2008-08-19 00:00:00 | 2010-06-02 00:00:00 | 653
2009-05-13 00:00:00 | 1000017540 | CHK - Checked-out | MH-GP | 9115 |  | 1000018602 | 2008-06-03 00:00:00 | 2008-06-19 00:00:00 | 17
2009-05-20 00:00:00 | 1000017540 | CHK - Checked-out | MH-GP | 9115 |  | 1000031132 | 2008-09-26 00:00:00 | 2008-10-22 00:00:00 | 27
2009-06-24 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000018218 | 2010-01-08 00:00:00 | 2010-01-15 00:00:00 | 8
2009-07-01 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000031044 | 2009-03-05 00:00:00 | 2009-10-01 00:00:00 | 211
2009-07-23 00:00:00 | 1000017540 | CHK - Checked-out | MH-IND | 9115 |  | 1000017347 | 2008-12-11 00:00:00 | 2009-08-12 00:00:00 | 245
2008-05-09 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000034190 | 2010-07-21 00:00:00 | 2010-07-21 00:00:00 | 1
2008-05-19 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000017068 | 2010-01-04 00:00:00 | 2010-01-04 00:00:00 | 1
2008-06-02 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000019244 | 2009-02-06 00:00:00 | 2009-02-06 00:00:00 | 1
2008-06-23 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000031806 | 2009-02-20 00:00:00 | 2009-07-09 00:00:00 | 140
2008-07-07 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000030716 | 2009-02-23 00:00:00 | 2009-02-23 00:00:00 | 1
2008-07-21 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000018429 | 2008-10-23 00:00:00 | 2009-03-18 00:00:00 | 147
2008-08-04 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000033236 | 2010-07-16 00:00:00 | 2010-07-16 00:00:00 | 1
2008-09-02 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000017357 | 2008-05-15 00:00:00 | 2009-12-08 00:00:00 | 573
2008-09-15 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000030392 | 2008-12-08 00:00:00 | 2009-03-16 00:00:00 | 99
2008-09-29 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114 |  | 1000030207 | 2008-09-16 00:00:00 | 2008-11-19 00:00:00 | 65
2008-10-13 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2008-10-27 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2008-11-17 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2008-12-01 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2008-12-16 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-01-05 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-01-26 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-02-09 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-02-12 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-03-09 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-03-16 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-03-30 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-04-13 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-04-27 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-05-04 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-05-18 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-06-01 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-06-15 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-07-09 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-07-21 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-08-10 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-08-31 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-09-21 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-10-12 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-10-28 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-11-23 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2009-12-14 00:00:00 | 1000017117 | CHK - Checked-out | MH-IND | 9114
2010-02-24 00:00:00 | 1000032692 | CHK - Checked-out | MH-IND | 9114
2009-02-25 00:00:00 | 1000031090 | CHK - Checked-out | MH-IND | 9114
2008-05-08 00:00:00 | 1000030217 | CHK - Checked-out | MH-GP | 9109
2008-08-19 00:00:00 | 1000030873 | CHK - Checked-out | MH-IND | 9115
2008-10-30 00:00:00 | 1000030873 | CHK - Checked-out | MH-AS | 9110
2010-03-24 00:00:00 | 1000030873 | CHK - Checked-out | MH-AS | 9114
2010-05-24 00:00:00 | 1000030873 | CHK - Checked-out | MH-IND | 1000033482
2010-06-02 00:00:00 | 1000030873 | CHK - Checked-out | MH-IND | 1000033482
2008-06-03 00:00:00 | 1000018602 | CHK - Checked-out | MH-IND | 9115
2008-06-06 00:00:00 | 1000018602 | CHK - Checked-out | MH-IND | 9115
2008-06-12 00:00:00 | 1000018602 | CHK - Checked-out | MH-IND | 9114
2008-06-19 00:00:00 | 1000018602 | CHK - Checked-out | MH-IND | 9114
2008-09-26 00:00:00 | 1000031132 | CHK - Checked-out | MH-IND | 9114
2008-10-08 00:00:00 | 1000031132 | CHK - Checked-out | MH-IND | 9114
2008-10-22 00:00:00 | 1000031132 | CHK - Checked-out | MH-IND | 9114
2010-01-08 00:00:00 | 1000018218 | CHK - Checked-out | MH-IND | 9108
2010-01-15 00:00:00 | 1000018218 | CHK - Checked-out | MH-IND | 9108
2009-03-05 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 1000030066
2009-03-12 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 1000030066
2009-03-19 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 1000030066
2009-03-26 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-03-30 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-04-21 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-04-27 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-05-04 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-05-18 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-05-26 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-06-03 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-06-10 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-06-12 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-06-17 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-06-19 00:00:00 | 1000031044 | CHK - Checked-out | MH-GP | 9115
2009-06-26 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-06-30 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-07-06 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-07-08 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-07-13 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-07-20 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-07-24 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-07-27 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-07-31 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-08-03 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-08-07 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-08-10 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-08-17 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-09-15 00:00:00 | 1000031044 | CHK - Checked-out | MH-GP | 9115
2009-09-21 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2009-10-01 00:00:00 | 1000031044 | CHK - Checked-out | MH-IND | 9115
2008-12-11 00:00:00 | 1000017347 | CHK - Checked-out | MH-IND | 9115
2009-06-04 00:00:00 | 1000017347 | CHK - Checked-out | MH-IND | 9115
2009-06-15 00:00:00 | 1000017347 | CHK - Checked-out | MH-IND | 9115
2009-08-12 00:00:00 | 1000017347 | CHK - Checked-out | MH-IND | 9115
2010-07-21 00:00:00 | 1000034190 | CHK - Checked-out | MH-IND | 1000033496
2010-01-04 00:00:00 | 1000017068 | CHK - Checked-out | MH-IND | 9110
2009-02-06 00:00:00 | 1000019244 | CHK - Checked-out | MH-IND | 9114
2009-02-20 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-02-25 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-03-04 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-03-11 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-03-18 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-03-25 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-04-01 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-04-08 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-05-13 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-05-20 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-05-21 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-05-29 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-07-09 00:00:00 | 1000031806 | CHK - Checked-out | MH-IND | 9115
2009-02-23 00:00:00 | 1000030716 | CHK - Checked-out | MH-IND | 9115
2008-10-23 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2008-10-29 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2008-11-05 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2008-11-24 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2008-12-08 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2008-12-15 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2009-02-25 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2009-03-18 00:00:00 | 1000018429 | CHK - Checked-out | MH-IND | 9115
2010-07-16 00:00:00 | 1000033236 | CHK - Checked-out | MH-AS | 1000033496
2008-05-15 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2008-05-29 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2008-09-18 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2008-10-21 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2008-10-31 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2008-12-16 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2009-03-25 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2009-10-14 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2009-10-22 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2009-11-05 00:00:00 | 1000017357 | CHK - Checked-out | MH-GP | 9114
2009-12-01 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2009-12-08 00:00:00 | 1000017357 | CHK - Checked-out | MH-IND | 9114
2008-12-08 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2008-12-15 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2008-12-30 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2009-01-13 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2009-02-02 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2009-02-11 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2009-02-23 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2009-03-09 00:00:00 | 1000030392 | CHK - Checked-out | MH-GP | 9115
2009-03-16 00:00:00 | 1000030392 | CHK - Checked-out | MH-IND | 9115
2008-09-16 00:00:00 | 1000030207 | CHK - Checked-out | MH-IND | 9108
2008-09-23 00:00:00 | 1000030207 | CHK - Checked-out | MH-IND | 9108
2008-09-30 00:00:00 | 1000030207 | CHK - Checked-out | MH-IND | 9108
2008-10-07 00:00:00 | 1000030207 | ARR - Checked-in / Arrived | MH-IND | 9108
2008-10-09 00:00:00 | 1000030207 | ARR - Checked-in / Arrived | MH-IND | 9108
2008-11-19 00:00:00 | 1000030207 | CHK - Checked-out | MH-IND | 9108