+ Reply to Thread
Results 1 to 10 of 10

Difference Between Two Times If a Time Exists in a Certain Column

  1. #1
    Registered User
    Join Date
    11-12-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    14

    Thumbs up Difference Between Two Times If a Time Exists in a Certain Column

    Hi,

    This is my first post here. Firstly I should say that I am an Excel novice. In the past I've dabbled in Excel using small amounts of data, but nothing on the scale that I need for this project.

    I am a Nurse in a local hospital and I have been tasked with auditing the time that patients spend in our clinic, from checking in, through a variety of tasks and finally seeing the Dr.

    I have uploaded a sample of my data:
    Patient Flow Audit Sample.xlsx

    Each clinic session that I am auditing will have its own spreadsheet that is the same as this sample. The only difference will be the number of lines of data as this depends on the number of patients in that session. Although I am considering setting up each sheet to have 25 lines (which is more than the max number of patients per clinic) to make them look the same and aid copying the formula for each new sheet of data.

    I am looking for help with formula's that would populate columns M, N, O and P.

    Column M:
    I need to ascertain the time between Column E and Column C but only if there is a time in Column E.

    Column N:
    I need to ascertain the time time between Column F and Column C but only if there is no time in Column E.

    Column O:
    I need to ascertain the time between Column F and Column E but only if there is a time in both Column F and Column E.

    Column P:
    I need to ascertain the time between Column G and the latest time in Column C, D, E or F.

    I have spent hours tinkering with different formulas with no success and lots of ###### values. I would appreciate any help anyone can give me. I have tried searching the internet for help but I simply don't know what sort of formula to even search for.

    Thanks for reading.
    Last edited by danieloverton1984; 11-12-2013 at 03:20 PM. Reason: Solved

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    See attached. You get the ##### because you can't have negative time.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    this is how i'd do the first three, col m, n and o.
    formula in m =IF(E2<>"",E2-C2,"")
    formula in n =IF(E2="",F2-C2,"")
    formula in o =IF(AND(E2<>"",F2<>""),F2-E2,"")
    then for p i'd likely use a helper column where I'd go for a max elsewhere (maybe in col v), =MAX(C2:F2)
    then do the difference between the max and col G value.

    EDIT: Alan's is a cleaner way then my last choice.
    Last edited by Sam Capricci; 11-12-2013 at 02:45 PM.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    Please find the attached sheet to see if this is what you want.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Registered User
    Join Date
    11-12-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    Quote Originally Posted by alansidman View Post
    See attached. You get the ##### because you can't have negative time.
    Thanks alansidman, thats great. I cant even decipher how the formula's do what they do so I don't think I would ever have got there.

    In Column N there are some ##### cells, is it possible to stop these displaying or for my AVG(N2:N13) in N15 to ignore any ##### so that I get a figure. If not I will delete them manually as going through and manually getting rid of them is a small price to pay in comparison to the work I would have had to do if you hadn't helped me with the formulas.

    Im hoping I might be able to transfer the same solution to column J and K as even though both have ##### cells, K wont give me an average either.

    Thanks again.

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    Try adding to your cell in N2 =IF(AND(E2="",F2<>""),F2-C2,"")
    that will get rid of the #####.

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    Change formula in J to this =IF(B2<A2,"",B2-A2).
    and change formula in K to this =IF(A2>B2,A2-B2,"")

  8. #8
    Registered User
    Join Date
    11-12-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    Thanks to the three of you I've combined the solutions into my "live" workbook and its working perfect.

    If only I understood how. LoL.

    Daniel.

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    Glad if that helped you. I'm an RN and I do a lot of data crunching and this forum is great for learning new tricks. Stop by anytime.
    And if this issue is solved for you don't forget to mark your post solved using the thread tools at the top and finally, you can thank all who've helped you by clicking on add reputation for them.

    EDIT: and thanks for the rep points!

  10. #10
    Registered User
    Join Date
    11-12-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    14

    Re: Difference Between Two Times If a Time Exists in a Certain Column

    I will defo be back to ask a few more questions. Especially when I've input the 40 or so clinics into their respective sheets and start to really crunch the numbers ready to present.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] time difference between two times
    By Kimston in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-27-2013, 03:43 PM
  2. Replies: 8
    Last Post: 08-21-2013, 07:57 PM
  3. How do find the difference between 2 times based on a third column
    By jtpryan in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-21-2013, 11:18 PM
  4. Replies: 3
    Last Post: 03-09-2012, 08:19 AM
  5. [SOLVED] HOURS DIFFERENCE IN TIME BETWEEN DIFFERENT DATES AND TIMES
    By tankerman in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-13-2005, 12:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1