+ Reply to Thread
Results 1 to 6 of 6

Create a new list and count occurrences

  1. #1
    Forum Contributor dagindi's Avatar
    Join Date
    06-02-2008
    Location
    New York, NY
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    295

    Create a new list and count occurrences

    I apologize if the title of this is a bit vague but I can't figure out another way to describe what I am trying to do...

    Attached is an example of an edited report I run at the end of each day. Note that the length of the report varies from day to day (it's dependent on how many orders are entered on a given day).

    I am trying to list all the Cust IDs (D707 to D760) on a new page and then in the next column total the amount of orders that were entered for that Cust ID.

    Im running into the following problems

    1. Starting on a new page
    2. Spaces in the new list caused by the subtotaling of the main list
    3. Totaling the orders by CustId.

    I added Sheet2 with the code I am currently using to get to this point along with what I've worked on so far:

    Sub EOD_Daily_Sale() - This is the main code that converts my raw data to the finished spreadsheet (& PDF).

    Sub EOD_Daily_Sale_test() - This is the start of the code to compile the list and copy it to the end of the sheet. Keep in mind that this sheet changes every day so I would like the list to begin 2 or 3 rows after last row (which has the Grand Total).

    Sub Macro2() - This is where I got stuck after I remove the duplicates in the list.

    Any help would be greatly appreciated.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    re: Create a new list and count occurrences

    I think this is what you're looking for. I wrote a macro in module 1. Run it, and let me know if that's what you were asking!

    Edit: this will only work for 100 or less User IDs (see the end of the code). Not sure why but using .resize(, last2) wasn't working for me
    Attached Files Attached Files
    Last edited by danielexcelvba; 07-26-2017 at 06:01 PM.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Create a new list and count occurrences

    Hi dagindi

    Here's another approach...CTRL + k will run the Code...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Create a new list and count occurrences

    other 1

    Please Login or Register  to view this content.
    Kind regards
    Leo
    Attached Files Attached Files

  5. #5
    Forum Contributor dagindi's Avatar
    Join Date
    06-02-2008
    Location
    New York, NY
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    295

    Re: Create a new list and count occurrences

    Some great stuff here! Thanks.

    I played with each of them for few a minutes but not long enough for proper feedback. I hope to post more tomorrow, but thanks for the all responses and help!

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Create a new list and count occurrences

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. Loop through list, add to Array, count number of occurrences, clear array
    By HalPlz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2016, 09:42 PM
  2. Replies: 19
    Last Post: 05-29-2014, 04:49 PM
  3. Count and list text occurrences
    By freelancercs in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2014, 06:05 AM
  4. [SOLVED] Count number of occurrences but if there are consecutive matches count them as one
    By michaljireht in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-26-2013, 08:26 PM
  5. [SOLVED] In a single cell, count any occurrences from a list of values
    By daedelous00 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-05-2013, 03:30 PM
  6. [SOLVED] Counting Occurrences of Items in a List Based on Separate List Values
    By wheel1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-10-2013, 01:04 PM
  7. Replies: 7
    Last Post: 05-11-2011, 12:36 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