+ Reply to Thread
Results 1 to 7 of 7

Counting rows efficiently

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3

    Counting rows efficiently

    Hi everyone. So I'm new here, and hope someone can help out

    Background info:
    I am extracting data from an electronic medical record (EMR) which has many search limitations. I am able to export data into a CSV file (attached) to perform some calculations (All the patient data is fake btw). I am trying to find the number of appointments for each patient within a specific date parameter. For each patient, one appointment appears on one row.

    pt appt sample.png

    Problem:
    What I want to do is count the number of rows (appointments) for each patient in an efficient manner. Right now I've just used the COUNTA function, but don't want to repeat this for every patient, due to the way that the workbook is set up. The data is all from the CSV file from the EMR; the only column I've added is the "Appointments since 2013" column.

    The patient data is fake because I am using a test server for the EMR. However out in a real doctor's office, there will be over 2000 patients with possibly up to about 100+ appointments.

    Not sure if there's formula out there that would make my task a lot easier and more efficient, or I need to play around with the columns to set it up differently. Any help is appreciated.

    EDIT: xls workbook is now attached.
    Attached Files Attached Files
    Last edited by nomnomgirl; 04-14-2014 at 04:04 PM.

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Counting rows efficiently

    Welcome to the forum.

    Can you post a sample excel workbook with the data already imported and laid out in the manner in which you want to proceed? Also you have a column stating # of Apointments then appts since 2013, How are those different? All in be more specific about what you are asking for and I think we can help.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

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

    Re: Counting rows efficiently

    Is this the result you want?
    Attached Files Attached Files
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  4. #4
    Registered User
    Join Date
    04-14-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Counting rows efficiently

    Quote Originally Posted by mikeTRON View Post
    Welcome to the forum.

    Can you post a sample excel workbook with the data already imported and laid out in the manner in which you want to proceed? Also you have a column stating # of Apointments then appts since 2013, How are those different? All in be more specific about what you are asking for and I think we can help.

    Ah,sorry, I should have posted the xls file in the first place. I've attached it now.

    The column for # of appointments is the total number of appointments a patient has had ever (i.e. including those before 2013). I am only interested in finding the appointments since 2013 because the EMR's report generator will not produce this number in any of the output columns. I have to count the number of appointments that fall within a specific date parameter, where one appointment is represented by a row underneath the patient number.

    Quote Originally Posted by popipipo View Post
    Is this the result you want?
    This definitely looks promising. Would I have to type in this formula for each patient,though? Also, can you explain the formula?

    Thanks for your help so far.
    Attached Files Attached Files
    Last edited by nomnomgirl; 04-14-2014 at 04:11 PM.

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

    Re: Counting rows efficiently

    =IF(ISNUMBER(A2);COUNTIF(A:A;"*"&(B2)&"*"&C2&"*");"")
    If A2 don't contain a number you don't get a result.
    Counting the Name (eg Bruce Wayne incl. wildcards) in range A:A

  6. #6
    Registered User
    Join Date
    04-14-2014
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Counting rows efficiently

    Quote Originally Posted by popipipo View Post
    =IF(ISNUMBER(A2);COUNTIF(A:A;"*"&(B2)&"*"&C2&"*");"")
    If A2 don't contain a number you don't get a result.
    Counting the Name (eg Bruce Wayne incl. wildcards) in range A:A
    Alright, thanks for clarifying the formula.

    Counting the patient name including wildcards worked in most cases, but there are instances where the row did not contain the patient's name, only the details of the appointment. This made the count inaccurate - see attached image. For example, rows A35 (Louis Audet) and A38 (Jessica Beaudry). This may happen with real data from a doctor's office.

    What would I do in this case?
    Attached Images Attached Images

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

    Re: Counting rows efficiently

    I don't have an answer for that.

+ 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] Macro to more efficiently copy/paste every 21 rows
    By Phil_Packer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-23-2013, 03:08 AM
  2. How to efficiently delete entire rows based on duplicates in one column
    By HughManatee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-16-2013, 06:53 PM
  3. SUM Rows in an Array efficiently
    By stufix in forum Excel General
    Replies: 2
    Last Post: 09-03-2006, 02:28 PM
  4. Howcan I delete blank rows efficiently
    By needyourhelp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-26-2005, 05:19 PM
  5. how to efficiently send many rows of data on a worksheet to the database using vba?
    By gozitash in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-01-2005, 11:06 AM

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