+ Reply to Thread
Results 1 to 4 of 4

Macro to count distinct values for each date

  1. #1
    Registered User
    Join Date
    11-22-2011
    Location
    New England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Macro to count distinct values for each date

    Hi!

    I have been googling around for some help on this issue and cannot seem to find anything for using VBA to give me a count of distinct values by date. Here is some data:
    ID Status Date
    Thing-1 Open 5/13/2016
    Thing-2 Open 5/17/2016
    Thing-3 Open 5/31/2016
    Thing-4 Done 5/25/2016
    Thing-5 Done 5/26/2016
    Thing-6 Done 5/26/2016
    Thing-7 Open 5/26/2016
    Thing-8 New
    Thing-9 Open 5/31/2016
    Thing-10 New
    Thing-11 Done 5/25/2016
    Thing-12 New
    Thing-13 Open 5/27/2016
    Thing-14 Blocked 5/26/2016
    Thing-15 New
    Thing-16 New
    Thing-17 Blocked 5/26/2016
    Thing-18 Done 5/31/2016
    Thing-19 Done 5/30/2016
    Thing-20 Open 6/1/2016

    After the macro is run, I need something like this to be pasted into a designated worksheet (e.g. Sheet3).
    5/13/2016 Open 1
    5/17/2016 Open 1
    5/25/2016 Done 2
    5/26/2016 Done 2
    5/26/2016 Open 1
    5/26/2016 Blocked 2
    5/27/2016 Open 1
    5/30/2016 Done 1
    5/31/2016 Open 2
    5/31/2016 Done 1
    6/1/2016 Open 1

    The items with no date would not show up (minor detail). I realize there are ways of doing this with Pivot tables or formulas with countif, sum, etc. I know how to spew out a count of distinct values, but I do not see how to add the "by date" criteria.

    Help will be greatly appreciated!

    --Jim
    Attached Files Attached Files
    Last edited by jbarbara11; 06-02-2016 at 06:10 PM.

  2. #2
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: Macro to count distinct values for each date

    Do you need a macro? Pivot table will do it neatly for you (see sheet two of the attached).

    If you really need a macro you could record a macro to prepare the pivot table
    Attached Files Attached Files
    Happy with my advice? Click on the * reputation button below

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to count distinct values for each date

    Jim,
    Try the attached.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-22-2011
    Location
    New England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Red face Re: Macro to count distinct values for each date

    Thanks AB33! No wonder I could not figure it out... seems this was a little tougher to do than I anticipated. You are indeed, a forum guru!

    Thanks again!
    Jim

+ 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. Count of Values (Rows) of Most Recent Consecutive Streak (2+ Distinct Values)
    By ExcelForum88 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-13-2016, 12:26 PM
  2. Count Distinct Values Per Attribute
    By scosner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-04-2014, 11:28 AM
  3. Count Distinct Values
    By trevordsmith in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-02-2014, 09:21 PM
  4. [SOLVED] Count Distinct Values
    By djfatboyfats in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-20-2012, 07:39 AM
  5. Count of distinct (unique) values by day
    By velorian in forum Excel General
    Replies: 7
    Last Post: 12-06-2011, 05:03 PM
  6. Count distinct values with criteria
    By greencardioid in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-29-2008, 06:48 PM
  7. Count Distinct Values?
    By bill_morgan in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-26-2005, 10:06 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