Consulting

Results 1 to 5 of 5

Thread: Formulate average count of DISTINCT records

  1. #1
    VBAX Regular
    Joined
    Jun 2008
    Posts
    72
    Location

    Formulate average count of DISTINCT records

    Hello. I am trying to formulate the following problem.

    I am looking to calculate the average Number of Resources (col D), for each DISTINCT Deal ID (col A) where the start date < Jan-10 and the end date > Jan-10.

    Any suggestions?

    The answer in this case should be 2.5. Because Deal #1 is a duplicate, I only want to include 1 row in the average. Thank you!
    Attached Files Attached Files

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    Not sure how you arrive at 2.5 as the result. Dropping one of the 4's results in 7 for the total # of resources, and divided by 3 gives the result of 2.3333

    I used this formula to arrive at the total number of unique ID's

    =SUM(IF(FREQUENCY(A2:A5,A2:A5)>0,1)) 
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    WE could do this by VBA but in this method, I just used a helper column F.

    F2: =IF(AND(A2<>A1,AND(DATE(2013,1,10)>=B2,DATE(2013,1,10)<=C2)),E2,"")
    Drag fill or copy F2 down to F5.
    F6: =AVERAGE(F2:F5)

  4. #4
    VBAX Regular
    Joined
    Jun 2008
    Posts
    72
    Location
    thanks. Aussiebear, Deal #3 does not meet the selection criteria. So the 2.5 = the average of 4 and 1.

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,060
    Location
    All too true. Forgot about the between dates criteria.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •