+ Reply to Thread
Results 1 to 15 of 15

Formula for calculating patient days with selected date range

  1. #1
    Registered User
    Join Date
    04-30-2014
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    10

    Formula for calculating patient days with selected date range

    I have been struggling with a formula. I have a spreadsheet where I need to calculate the number of days between two dates. However that calculation of days should only be calculated if the dates fall within a specific date range.

    For instance, I need to calculate the Length of Stay (LOS) for each patient whose date range falls within date range of example:
    Admit Date 03/01/2014
    Discharge Date 03/31/2014
    Where the date of discharge is not counted unless the patient was only admitted for one day.

    Patient Name Admit Date Discharge Date Length of Stay
    Patient A 02/28/2014 03/01/2014 0 (This day would be counted in February)
    Patient B 03/01/2014 03/03/2014 2
    Patient C 03/05/2014 03/12/2014 7
    Patient D 03/31/2014 04/01/2014 1
    Patient E 02/27/2014 03/02/2014 3
    Patient F 03/29/2014 04/03/2014 3

    Any assistance would be appreciated.

    Thank you,

    HospitalOfficer
    Attached Images Attached Images

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

    Re: Formula for calculating patient days with selected date range

    Not sure exactly how do you want it to get done, try this to see if this is what you are trying to do...

    In D6.....

    Please Login or Register  to view this content.
    and drag down.
    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.

  3. #3
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Formula for calculating patient days with selected date range

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    With the start of the date range in D1 and the end of the date range in E1, the admission date in B2 and the discharge date in C2. It can then be dragged down.

  4. #4
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Formula for calculating patient days with selected date range

    This is the formula I get but it does not match your last date. Please explain how it is 3 for Patient F? I get 5 or 2.


    Paste in D6 and copy down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Shelton A.
    If Helpful, Add Reputaion!

  5. #5
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Formula for calculating patient days with selected date range

    I Have revised my formula, but I also think you have a calculation wrong, but for Patient E.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Patient E is only there for 2 days of the period specified, but you said to not include the discharge day, so it should be 1.
    Last edited by gak67; 05-01-2014 at 12:21 AM.

  6. #6
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Formula for calculating patient days with selected date range

    Quote Originally Posted by playaller View Post
    This is the formula I get but it does not match your last date. Please explain how it is 3 for Patient F? I get 5 or 2.
    The three days are 29, 30 and 31 March.

  7. #7
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Formula for calculating patient days with selected date range

    Got cha. Try this:

    Paste in D6 and drag down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by playaller; 05-01-2014 at 12:40 AM.

  8. #8
    Registered User
    Join Date
    04-30-2014
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Formula for calculating patient days with selected date range

    Hi

    Thank you for your response. When calculating patient days, I can only count days that occur within the required period, excluding the date of discharge unless the patient only had a one day stay. For instance a patient from 2/27 - 3/1, would not have any patient days in the month of March because they were discharged on the 1st. However they would have two patient days for the month of February, 2/27 and 2/28. Since I am referencing March. I would not expect to see any days.

    The formula is calculating correctly for some, but not for others. See attachment.

    See Excel Export.

    Thank you.
    D
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-30-2014
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Formula for calculating patient days with selected date range

    You are correct, my calculation is wrong is Patient E. I will try this formula and see if it works.

  10. #10
    Registered User
    Join Date
    04-30-2014
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Formula for calculating patient days with selected date range

    gak67

    I apologize, I am new to the forum. I think your formula worked. I am going to test try it today on our EOM stats and let you know.

    HospitalOfficer

  11. #11
    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: Formula for calculating patient days with selected date range

    this formula seems to match what you want...
    =IF(A6=B6,1,IF(A6<$A$1,DATEDIF($A$1,B6,"yd"),IF(A6>=$A$1,(DATEDIF(A6,B6,"yd")))))
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  12. #12
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Formula for calculating patient days with selected date range

    Quote Originally Posted by Sambo kid View Post
    this formula seems to match what you want...
    =IF(A6=B6,1,IF(A6<$A$1,DATEDIF($A$1,B6,"yd"),IF(A6>=$A$1,(DATEDIF(A6,B6,"yd")))))
    This will return 1 for all instances of when the admission date equals the discharge date, but the OP only wants those in the date range specified.

  13. #13
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: Formula for calculating patient days with selected date range

    =IF(AND(A6=B6,A6<$A$2,A6>=$A$1),1,MIN(B6,$A$2)-MAX(A6,$A$1))

    Try this one

    Change A2 from 31-3-14 in 1-4-2014 (dd-mm-yyyy)
    Last edited by popipipo; 05-01-2014 at 04:03 PM.
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  14. #14
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Formula for calculating patient days with selected date range

    It seems the layout of your uploaded document differs from what I started as now there is no patient column. I have updated my code and attached your document with the coding as well. You can paste the below code in C6 and pull down.


    Paste in C6 and pull down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by playaller; 05-02-2014 at 03:49 PM.

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

    Re: Formula for calculating patient days with selected date range

    This formula should meet all the criteria you have set.

    Please Login or Register  to view this content.
    See the attached sheet.
    Attached Files Attached Files

+ 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. Formula calculating AVG # of orders per patient on given date
    By happy3sum in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-22-2013, 06:10 AM
  2. Calculating time elapsed in days and count days within same range
    By michellem410 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-19-2008, 01:13 PM
  3. Replies: 3
    Last Post: 06-28-2006, 05:40 PM
  4. Replies: 6
    Last Post: 09-06-2005, 03:05 AM
  5. Replies: 6
    Last Post: 09-06-2005, 01:05 AM

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