+ Reply to Thread
Results 1 to 22 of 22

Formula (no VBA) to count rows with varied rules

  1. #1
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Formula (no VBA) to count rows with varied rules

    If you had this data set:
    Task A, User ID: 34565, Action Taken, User A, 9/18/15
    Task A, User ID: 34565, Action Successful, User B, 9/18/2015
    Task A, User ID: 45682, Action Taken, User A, 9/17/2015
    Task A, User ID: 56789, Action Successful, User B, 9/16/2015

    What formula(s) would you use to count how many times User B had an “Action Successful” on “User ID: 34565” on the date 9/18/15 where User A also had an “Action Taken” on the same User ID on the same date?

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Formula (no VBA) to count rows with varied rules

    Hi, welcome to the forum

    for future reference, please upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.

    It sounds like you need to use COUNTIFS() for this. Something like...
    =countifs(D:D,"User B",C:C,"Action Successful",B:B,“User ID: 34565”,E:E,"9/18/15")
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula (no VBA) to count rows with varied rules

    =MIN(COUNTIFS(B1:B4,UserID,C1:C4,"Action Successful",D1:D4,"User A",E1:E4,date_reference),COUNTIFS(B1:B4,UserID,C1:C4,"Action Successful",D1:D4,"User B",E1:E4,date_reference))
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Formula (no VBA) to count rows with varied rules

    @ daffodil, why the MIN()? What am I missing?

  5. #5
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    Thank you so much FDibbins and daffodil11. I will be sure to use that guidance in the future. I am wondering if I could tack on another layer of complexity. I think I misspoke, I am actually looking to count how many times one user has that "action taken" status and another user has that "action successful" status on the same user id. The data set is large and I won't be able to plug in that user id everytime. I guess for that section of the formula, it would need to comb column B for duplicates.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula (no VBA) to count rows with varied rules

    Looking at the sample data, I'm seeing

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


    But that relies on one big assumption, that 'Action Successful' will always be directly below 'Action Taken'

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,215

    Re: Formula (no VBA) to count rows with varied rules

    Because there may be more on one case than the other e.g. more "Taken" than "Successful"? so take the lowest as matches.

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula (no VBA) to count rows with varied rules

    Thank John. I knew I couldn't be all nuts on that.

    I assumed the mininum where both were true.
    If User A has 5 instances and User B has 3 instances, then I think they both matched a total of 3 times since there would need to be a one-to-one relationship.

    Cabbie: If your data is complex, than I'd recommend attaching a desensitized version of your data. Otherwise we'll just be blindly throwing ideas at you.
    Last edited by daffodil11; 09-18-2015 at 01:32 PM.

  9. #9
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula (no VBA) to count rows with varied rules

    Based on the simple logic that John and daffodil have applied, it seems reasonable to assume that an action can't be successful if it hasn't been taken, so you should only need to count the successful actions.

    Looking from a different angle, if 'User B Action Successful' could be tied to 'Action Taken' by 'User A' or 'User C' then you could get miscounts from this method.

  10. #10
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    daffodill11 great point! Thank you! Will attach shortly. Thank you!

  11. #11
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules


  12. #12
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula (no VBA) to count rows with varied rules

    Here's my first stab at it.

  13. #13
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    Thanks daffodil11. I soooo apprecaite you taking the time!/My only concern here is that there are varying IDs here unique to each task. It is possible for user B to have a success logged independent of a productivity being logged. For example, if user b takes action a task ID on 8/31/15, but sees success for that ID on 9/1/15, we would not want to count that. Does that make sense? I think the final formula would need to look at the values in row C and count only if those values were the same in each of the countif statements you've written.

  14. #14
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    Essentially, I am looking to count these instances if and only if the "task productivity" and "task status" cells match the same idea. See example below:

    Task Task Productivity 11003138 robotautomation 08/31/2015
    Task Task Success 11003138 User E 08/31/2015

  15. #15
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula (no VBA) to count rows with varied rules

    What does your ideal output look like?

  16. #16
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    daffodil11 my ideal output would be exactly what you created. The only addition would be making sure that we only count if the ID is the same. Does that make sense? So, if we say User B was successful... we would want to know if User B was successful where user A was productive. The key that binds these two is the unique ID.

  17. #17
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    Hi there, Team! Is it kosher to add this conundrum to another thread?

  18. #18
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula (no VBA) to count rows with varied rules

    Sorry that took a while, but things got complicated.

    This array formula did it for me:

    Please Login or Register  to view this content.
    Where N7 was a date, H8 was the was the starting name, J8 is the ending name.

  19. #19
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula (no VBA) to count rows with varied rules

    Holy double post, Batman.

  20. #20
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    daffodil11 tell me about it! Thank you for giving my issue so much thought! Great that it worked for you! Can you share with me for which date you tested the array formula on and the output?

  21. #21
    Registered User
    Join Date
    09-18-2015
    Location
    New York, NY
    MS-Off Ver
    2013
    Posts
    10

    Re: Formula (no VBA) to count rows with varied rules

    daffodil11 it looks like it isn't working for me this time around.

  22. #22
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula (no VBA) to count rows with varied rules

    Here's an example all filled out.

+ 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. Macro that pics varied lengths of Rows
    By skashyap in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 10-26-2015, 09:34 AM
  2. Formula for accumulating values of numbers in varied location
    By JonasDude in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-07-2015, 09:55 AM
  3. Data from 4 columns to populate into varied report - formula or VB?
    By Missy O in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-24-2013, 06:06 PM
  4. [SOLVED] How to create a Cumulative Total formula from varied data
    By Addict in forum Excel General
    Replies: 6
    Last Post: 05-29-2012, 01:18 PM
  5. Replies: 9
    Last Post: 08-11-2010, 02:41 PM
  6. Replies: 2
    Last Post: 03-30-2010, 12:41 PM
  7. Replies: 3
    Last Post: 06-25-2006, 02:30 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