+ Reply to Thread
Results 1 to 6 of 6

Countif Function

  1. #1
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Countif Function

    Hi guys I have an issue im stuck on. What im trying to do is count the number of occurrences before and after a certain number. I have a list of data in three columns and I want to count the number of CPT Codes before and after CPT code 59510, 59400 or 59610 for each MRN. In the attached spreadsheet I have some sample data with expected results.

    Thanks in advance.
    Attached Files Attached Files
    Last edited by day92; 10-15-2012 at 06:14 PM.

  2. #2
    Registered User
    Join Date
    10-08-2012
    Location
    Teesside, England
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Countif Function

    Add a column for cpt to your results table (column F) then you can type this into G3

    =INDEX(MATCH(F3,C:C,0),1,1)-2

    to give the row count before the instance of any value typed into F3 (excluding column title). Any instance after can be found by the formula

    =COUNTA(C:C)-(G3+1)

  3. #3
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: Countif Function

    Hi Uncle - thanks for the formula but that does not really solved my issue. It only gives me the count of CPT before a certain number but it does not do it by MRN nor does it give me the count after a certain number. Unless I missed something?

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Countif Function

    day92,

    Attached is a modified version of your example workbook.
    I added a helper column in your output table named "cpt"
    The helper column is in column F

    In cell F3 and copied down is this formula:
    Please Login or Register  to view this content.

    In cell G3 (Before) and copied down is this formula:
    Please Login or Register  to view this content.

    In cell H3 (After) and copied down is this formula:
    Please Login or Register  to view this content.

    Is something like that what you're looking for?
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: Countif Function

    TA - you are amazing that is exactly what I was looking for. Thanks a lot man. Ive been racking my brains all morning trying to figure that out.

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Countif Function

    You're very welcome

+ 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