+ Reply to Thread
Results 1 to 9 of 9

Counting with multiple conditions

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Counting with multiple conditions

    I have a raw data set that lists items by their unique identification # in the first column (1 item per row), there is then a status, date and time in one cell for each "status" for the course of the item's life presented like this "F7 24MAY2012:00:47:40" (Status = F7, date = 24MAY2012 & Time = 00:47:40 (24 hour clock stamp)). I have a second sheet that breaks down the raw data by spliting the status and date from time using LEFT() and MID (), which reads out the hour, like:
    Bcst_Statu _D Bcst_Statu _D
    D2 19APR 20 D4 27APR 07
    D2 19APR 20 D4 30APR 10
    D2 30APR 17 D4 01MAY 06

    This data reads from column "H" to "CE".

    I want to be able to count status "GA" for first and second shift. (I.E. "GA 22MAY" from time "6-24" hour & "GA 23MAY" from time "0-4" and report out how many occur in between these times.) The other problem is that the "status" are not all in the same column, "GA" status can range from column N to AF in the Raw Data sheet.

    I've tried:
    =COUNTIFS('Refined Data'!$A$1:$CE$1731,D2,'Refined Data'!$A$1:$CE$1731,">=6")+COUNTIFS('Refined Data'!$A$1:$CE$1731,D3,'Refined Data'!$A$1:$CE$1731,"<=4")

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Counting

    Hi BradDenton,

    Could you post a sample sheet? And, are you amenable to a User Defined Function (UDF)?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    05-29-2012
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting with multiple conditions

    Raw Data: Sample Data File.xlsx

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Counting with multiple conditions

    Hi BradDenton,

    I got 421 with your criteria - does that sound right? If so, I'll try to make the macro into a function.

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Counting with multiple conditions

    Hi,

    Make that 1765 hits.

  6. #6
    Registered User
    Join Date
    05-29-2012
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting with multiple conditions

    If counting for "GA 22MAY" between hours of 6am-midnight and "GA 23MAY" from Midnight - 4am it should come up with only 24.

    In this instance there are none on 23MAY between midnight - 4am.

    If you try to count GA status for 23MAY 6-mid and 24MAY Mid-4am you should get 77

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Counting with multiple conditions

    Hi BradDenton,

    Got it! 24 and 77 - I'll try to make it be a function - Do you want the macro?

  8. #8
    Registered User
    Join Date
    05-29-2012
    Location
    Milwaukee, WI
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Counting with multiple conditions

    Yes the macro would be great. I am very interested to see how you got it running!

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Counting with multiple conditions

    Hi BradDenton,

    I lost the macro but the function is up and working. Here's a copy of your book - I didn't paste all the fields, just a few at the beginning and the end. The trick was in using the date #......# entry.
    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)

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