+ Reply to Thread
Results 1 to 16 of 16

countif column range equals any other cell in same range

  1. #1
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Question countif column range equals any other cell in same range

    Hi all,

    I'm trying to count the number of re-admissions within a certain time frame (let's say no more than 60 days apart) by sorting data by patient id# then discharge date and counting the number of repeat values in this column that occur within this time frame. I was thinking a COUNTIFS would do the trick but do not know how to tackle the issue of writing a criteria expression for any cell in a cell range equaling any other cell in that same range. Basically I need the number of occasions where an ID# is reoccurs inside the time window.. So an ID# that shows up 9 times but only 4 instances of closely spaced consecutive service would count as 4. Also, a count of unique patient ID#s that fulfill the re-admission criteria would be useful..

    I suppose this is a common manipulation in business terms as "repeat customers"..
    Any help would be much appreciated. Thanks!
    Last edited by pacer31; 06-27-2011 at 05:24 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: countif column range equals any other cell in same range

    Hi pacer31,

    I created some fake data to show how I might tackle this problem. The first in Col C is a counter of all IDs that are the same above the current rows ID. Then I created in D an Index so I could calculate how many days this ID happened since the first ID showing. I hope you can use this example and expand it to fit your needs.

    see attached.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    Yes yes! Thank you for that, your sheet was more than enough for me to get exactly how to manipulate the data the way I needed. I may need to add additional qualifiers for better summarization of the data, but I believe everything from here I can handle. If not, I'll seek you out for more guidance if that's cool. Again, thanks for the help! It was more than I could expect!

  4. #4
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    So I guess I'm not as clever as I thought..

    I was able to make a countif for the number of <=30-day re-admissions, but I also I need to add a column that shows if the patient has an occasion of <=30-day re-admission (not necessarily because of the particular visit). As in, a column that states if the patient ID# is linked to one of these events. Thus far, I have "admission counter", "days since last admission" columns, and an if statement column stating yes/no if the specified visit triggers a tick to the count

    Thanks!

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: countif column range equals any other cell in same range

    Hi pacer31,

    I need a few more facts on this mythical problem.

    You have patients who come in for appointments. You need to track how these are tied together. It sounds like a billing question to me. Something like the Patient has a car accident and you get to bill the insurance for 90 days of physical therapy tagged to the car accident. Then if they fall and hurt themselves and need therapy they need to change the reason or billing for the new problem.

    I guess I need more specifics on how you currently track how an appointment is tied to a previous one.
    A sample workbook would also help. You can attach a sample by clicking on "Go Advanced" and then the Paper Clip Icon above the message area.

  6. #6
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    It's for a report on an initiative grant aimed at reducing this population's quick re-emergence of necessary servicing. The data is sorted by patient# followed by discharge date. Maybe there's a simple formula in using the if(Q11<=30, Y, N) re-admission counter in conjunction with same patient#? Basically goal is for each patient# that has any Y values in Q cell, all values in new column R equal Y.

    Let me know if more info is needed, thanks!

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: countif column range equals any other cell in same range

    Hi pacer,

    I don't know what you have in column Q or R as I don't have a sample of what you are looking at. If you can attach a sample workbook, we might get farther with an answer we both understand.

  8. #8
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    Sry I was being lazy!
    "REG#" is generated for each visit. I think all the other columns are self-explanatory..
    Thanks!
    Attached Files Attached Files

  9. #9
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: countif column range equals any other cell in same range

    OK - I'm on a dumb day.

    What do you want in the green area of your attached? # Patient... ?? Is that the Number of Patients or the Number of the Patients??

  10. #10
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    lol probs a still a smart day for the average guy...
    It's the number of unique patients that fulfill this criteria (of being readmitted within 30 days)
    I also need to be able to add a column denoting if the patient is one of these patients, though not necessarily because of that record row..

    Thank you!!!

  11. #11
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: countif column range equals any other cell in same range

    Hi pacer31,

    I suspect you are going to need another column of data to specify if the date was an Admission or a Visit. It seems your answer of 3 in cell N6 doesn't give you what you want. I was thinking it was the Number of Patients who had been readmitted in the last 30 days.

  12. #12
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    Oh no, not in the last 30 days... I need to be able to make these counts from about 5000 records..
    It looks to me that N6 gives the right answer. Sorry I may have caused confusion using visits and admissions interchangibly. Every time I say admission/visit it means inpatient admission.

    The concern is to count the number of times a patient has been admitted less than 30 days from the previous time. As well as the number of unique patients that have done so.

    I'm not sure if sorting of the data is needed or not, but it is currently sorted by patient id# then date .. if that makes it any easier.

  13. #13
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: countif column range equals any other cell in same range

    You will need to sort by date to run the counter column formulas in Column E. That was the key to my answer in the last attached file.

    See if that doesn't give you the answer you need.

  14. #14
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    Yeah I just tried sorting by date.. it doesn't seem to matter if its sorted by date only or patient then date. Still getting a count of 3 (G5, G9, G21 when sorted patient, then date) and non of hte values change... I believe as long as the dates are in order the same conclusion is reached. Also, in checking the count from my 5000 record sheet with a superior, I'm told the count seems right.

  15. #15
    Registered User
    Join Date
    05-02-2010
    Location
    USA
    MS-Off Ver
    Excel 03/07
    Posts
    17

    Re: countif column range equals any other cell in same range

    Hey Marvin,

    Just wanted to let you know I figured it out using a new sheet, if/countif/counta formulas and the filter unique entries feature on excel.

    Thanks a bunch!!!

  16. #16
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: countif column range equals any other cell in same range

    GREAT!

    Now edit the first post in this thread and change the Prefix of the Title to Solved. This helps us know who is still looking for answers and who is not.

    I see you are ahead of me on this - Good Job a second time. Glad you got an answer. This was a little tougher than the normal problem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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