+ Reply to Thread
Results 1 to 8 of 8

Complicated 2D counting

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Complicated 2D counting

    I have the attached document (simplified, truncated, etc). The real one has 100 names, hundreds of dates etc so this can not be done by hand.

    I need to have a count of unique dates that Name X, worked at Location that starts with OP, between the date range in A:A, B:B

    I can do a count using a "countifs" or "sumifs" (something like E3) but if the Name moved from one location to the next in the middle of the day, it will overestimate how many days they worked. Is there a way to merge a formulated. Any ideas?
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Complicated 2D counting

    Post the results for the given period in you file (manualy).

    After that I will take a look if I get an solution for you.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  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: Complicated 2D counting

    Will the dates always be out of chronological order?

    I can do this if the dates are sequential, but on Sheet1 you go from 1/5 to 1/6 back to 1/5 and that's throwing for a loop. If all the dates were grouped together, even if duplicate, I could filter them out.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Complicated 2D counting

    Try this array formula**:

    =SUM(IF(FREQUENCY(IF(J2:J23>=A3,IF(J2:J23<=B3,IF(N2:N23=A1,IF(LEFT(O2:O23,2)="OP",J2:J23)))),J2:J23),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Complicated 2D counting

    It worked perfectly. Thank you!

    The one problem with excel though is that Arrays of any size and complexion are seriously taxing w/r to resources. Will this work with a file 40k lines long?

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Complicated 2D counting

    Yes, but it may take a few seconds to calculate.

  7. #7
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Complicated 2D counting

    Hello,

    I have a similar problem and I keep getting a count instead of a unique count. What am I missing? Please see attached.

    Thank you!
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-15-2013
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Complicated 2D counting

    NM... Figured it 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. A complicated Loop with lots of IF's and a method of counting similar dates...
    By hellsadvocate in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2013, 12:48 PM
  2. Replies: 6
    Last Post: 02-04-2012, 06:57 PM
  3. complicated row searching/counting
    By sasquatchbill in forum Excel General
    Replies: 1
    Last Post: 11-15-2007, 08:27 PM
  4. Complicated Counting Function
    By outthere in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-26-2007, 11:24 AM
  5. [SOLVED] Complicated counting of cells (based on other cells contents)
    By George in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-07-2005, 02:45 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