Forum Discussion

mkollman's avatar
mkollman
Copper Contributor
May 24, 2022
Solved

Trying to work with time criteria

I have a spreadsheet with patient appointment times and patient check in times both formatted as mm/dd/yyyy h:mm A/P.  I am trying to analyze how often patients are checking in late, and how late are they (>3 minutes, >5 minutes, >7 minutes, >10 minutes).  There are two columns that demonstrate the difference between appointment time and check in time.  The first simply subtracts the appointment time from the check in time and produces a result in decimal format with early check in represented as a negative.  This column of results is formatted as "general".  The second column of results uses the formula =IF(J3-E3>=0,TEXT(J3-E3,"h:mm"),TEXT(ABS(J3-E3),"-h:mm")) and displays results as h:mm but the column is formatted as "general".

 

I can't seem to write an equation that will count how many of these appointments meet the various lateness criteria referenced above. I have tried various if, then and countif formulas and keep getting the generic "there is a problem with this formula".

  • mkollman's avatar
    mkollman
    May 24, 2022
    I believe your response has led me to the answer. I think your original formula had a typo, and I applied it incorrectly. I believe you meant to suggest 1440*(J3-E3). When I do that and use the J3-E3 result that produced result in decimal format instead of the result in hh:mm format, it works!! THANK YOU.

7 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    mkollman 

    As variant you could try to calculate on source data like

    =SUMPRODUCT(
       (checkinTimeRange > appointmentTimeRange)*
       ( MOD( checkinTimeRange - appointmentTimeRange,1) >
         TIME(0,3,0) ) )
    • mkollman's avatar
      mkollman
      Copper Contributor
      Sergei -
      Thank you for your response. I have entered your formula as follows: =SUMPRODUCT((J3>E3)*(MOD(J3-E3,1)>TIME(0,3,0))) The result produced is zero regardless of the actual difference between appointment time and check in time.
  • mkollman 

    It might be easier to calculate the difference as a number of minutes instead of a text value that represents time.

    Use =1440*(J3-E3) and format the cell with the formula as General or as Number with 0 decimal places.

    You can then use formulas such as =COUNTIF(difference_range, ">3") etc.

     

    Edited to correct mistake

    • mkollman's avatar
      mkollman
      Copper Contributor
      I believe your response has led me to the answer. I think your original formula had a typo, and I applied it incorrectly. I believe you meant to suggest 1440*(J3-E3). When I do that and use the J3-E3 result that produced result in decimal format instead of the result in hh:mm format, it works!! THANK YOU.
    • mkollman's avatar
      mkollman
      Copper Contributor

      HansVogelaar   Thanks for your response.  I used the formula you noted, and the result is 50761039.  In this case, the actual difference between appointment time and check in time was -4 minutes (the patient checked in 4 minutes early).  I am stumped... 🙂

Resources