+ Reply to Thread
Results 1 to 7 of 7

count number of dates within given time period

  1. #1
    Registered User
    Join Date
    07-28-2010
    Location
    london, england
    MS-Off Ver
    Excel 2007
    Posts
    91

    count number of dates within given time period

    Hi all,

    I am completely at a loss for how this can be done or even if it can be done at all....

    I have attached a copy of a sheet with dummy data entered. I'm looking for 2 formulas to count the number of people who are seen within 3 weeks of referal and then either discharged within 6 weeks (formula 1) or given a perscription within 6 weeks and then go on to receive 4 or more follow appoinments within 1 year (formula 2).

    Ideally formual 1 (Number seen within 3 weeks of referal and discharged within 6 weeks) would return 1 (person 3) and formual 2 (Number seen within 3 weeks, given prescription within 6 weeks and receive => 4 follow up appointments) would return 1 (person 1).

    Many thanks in advance for any help,
    Attached Files Attached Files
    Last edited by j.farr3ll; 08-18-2013 at 02:50 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: count number of dates within given time period

    Take out the N/A in columns D and E and you can use:

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


    to get the first value.


    If you add a "Follow up" helper column in column G with the formula: G2 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ... you can then use:

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


    to get the second value.


    You haven't got a lot of data so you'll need to check it out but it looks as though it will work.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-28-2010
    Location
    london, england
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: count number of dates within given time period

    These are amazing. thank you so much! For the second formula it doesn't seem to limit to counting 4 or more follow ups within a year though? Is this possible?

    Can I also ask what does the -- denotion mean in the formulas?

    Thansk again,
    James

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: count number of dates within given time period

    it doesn't seem to limit to counting 4 or more follow ups within a year though?
    Well, you didn't say "within a year". It is counting occurrences of that patient ID, less 1, assuming the first visit doesn't count. Hence, is the helper column >= 4?

    Unless you repeat the referral date in each patient record, I don't see how you will be able to produce the figure that you are looking for. If you do, you might be able to use a COUNTIFS function to calculate how many entries are within a given timeframe, for example, referral date + 365.

    The separate elements of the formula would create a matrix of TRUE or FALSE entries. The -- coerces those boolean values int 1s and 0s which can then be multiplied together and added up.


    Regards, TMS
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-28-2010
    Location
    london, england
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: count number of dates within given time period

    Ah I realise now I wrote within a year in the text at the top but not further down in the example or in the spreadsheet. Sorry that was my bad.

    You are quite right that the first value doesn't count. I think I'm nearly there by creating 2 more helper columns in H and I and altering the last part of the formula, but I need to alter what I'm doing in H as currently it is not doing a calculation which helps acheive the end goal

    Thanks,
    James
    Attached Files Attached Files
    Last edited by j.farr3ll; 08-16-2013 at 09:42 AM. Reason: Just realised how wrong I was with this...

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: count number of dates within given time period

    To quote:

    count number of dates within given time period
    and:

    count the number of people who are seen within 3 weeks of referal and then either discharged within 6 weeks (formula 1) or given a perscription within 6 weeks and then go on to receive 4 or more follow appoinments within 1 year (formula 2).

    3 weeks and 6 weeks are "time periods" as is "within 1 year" ... I saw the first but not the latter as I was focused on the requirement in the third paragraph. So, not entirely your fault However, as I said, you'd need to do something more to get the second formula.


    The problem with the formulae you have is that you need to get that counter on the row with the original appointment.

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



    and then this:

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


    should give you what you're looking for.

    It looks as though column G is redundant ... I've deleted the contents to demonstrate but you should be able to delete the column.

    Regards, TMS
    Attached Files Attached Files

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: count number of dates within given time period

    One other thought. Be interesting to test what happens when a patient has another appointment sometime in the near future. I think it might get a bit messy then.

    I haven't done anything with it but I think a way around it is to have appointment numbers. They could be unique to the individual or just unique, full stop. Whatever, I think you'll need to be able to isolate patient/appointment rather than just patient.


    Regards, TMS

+ 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] Count the number of months between 2 dates but only in a defined period
    By forrestgump1980 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 10-28-2014, 05:24 PM
  2. Count unique occurrences of dates within period
    By areynolds in forum Excel General
    Replies: 6
    Last Post: 10-26-2011, 01:31 PM
  3. Replies: 2
    Last Post: 05-28-2010, 04:57 PM
  4. How to count dates in a 12 month rolling period
    By butlej6 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 06-05-2008, 06:00 PM
  5. How do I count dates in a 12 month rolling period?
    By butlej6 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-05-2008, 05:25 PM

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