+ Reply to Thread
Results 1 to 10 of 10

Count number of trips by occurences

  1. #1
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Count number of trips by occurences

    Hello,

    I have a table with 31 days; each day consists of 15 groups; each group consists of several trips; each trip has only one of the 3 colors (value =1). I need macros to:

    1) For each color, count the total number of trips that have the same sum of color = 0, or 1, or 2....
    2) For each trip, mark similar trip with a code (so I can do grouping later). For example, in "Color 1" column, all trips that have the sum of color = 1 are marked as "C1_1", sum of color = 2 are marked "C1_2", etc.

    Please see the attached Excel file as a sample of original data and desired outcomes (shaded).

    I appreciate your help.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Count number of trips by occurences

    Any solution?

  3. #3
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Count number of trips by occurences

    You are going to have to explain how you come to the totals in your file. Pick one from each color group and explain in detail.

    I used a SUMIF to calculate totals, but I'm not getting the same numbers as your example.

    E.g. in O2
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Tinbendr; 05-31-2013 at 12:03 PM.
    David
    (*) Reputation points appreciated.

  4. #4
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Count number of trips by occurences

    Quote Originally Posted by Tinbendr View Post
    You are going to have to explain how you come to the totals in your file. Pick one from each color group and explain in detail.

    I used a SUMIF to calculate totals, but I'm not getting the same numbers as your example.

    E.g. in O2
    Please Login or Register  to view this content.
    Thank you for your reply.

    I attached the revised file with formula to explain how I came to the total at Column N (used info from column P-T). I apologize for the wrong totals that I posted early.

    Column A to F consist of raw data. I made up manually column H to T to explain the desired outcomes.
    Attached Files Attached Files

  5. #5
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Count number of trips by occurences

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Count number of trips by occurences

    Hello Tinbendr;

    Thanks very much for your SUPERB Macro skill.

    Could you help me with the second part of the question? (assign same value to all trip that have same ID. For example: for color 1, all Ttrip ID = 1 will have value of 0; color 2 will have value of 2; color 3 will have value of 0). Pleasee see the attached.
    Attached Files Attached Files

  7. #7
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Count number of trips by occurences

    It's the same formula as Columns R-T

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Count number of trips by occurences

    Cannot be better! I'm wondering how long it would take a person to reach your macro level

  9. #9
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Count number of trips by occurences

    It took me several years of trial and error before I stopped asking questions and started answering them.

    My advise is to invest in a book or two. I have Excel 2000 Formulas and Excel Power Programming with VBA by John Walkenbach.

    I also watch Mr. Excel and ExcelIsFun videos on the youtube channel. (Actually, I just recently watched ExcelIsFun 997-999 videos and he used the same type of lookup as I did on your sheet.)

  10. #10
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Count number of trips by occurences

    Thanks very much for advice. It was remarkable that you could go that far by self-leaning.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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