+ Reply to Thread
Results 1 to 8 of 8

Counting number of occurences in column

  1. #1
    Registered User
    Join Date
    12-14-2007
    Posts
    20

    Counting number of occurences in column

    I will attach two files along with this thread to better explain my question. I would like to take the data that is in Column A of Histogram Test file and somehow get excel to count the occurences each number is listed. I would like to have that information listed along the numbers in Column A of Histogram Test 2 file. Any help would be greatly appreciated. I will show an example of what I would like it to look like here:# of occurences can be in Column B if easier:
    0-1
    1-2
    2-1
    3-6
    4-1
    5-1
    6-4
    7-1
    8-4
    9-3
    11-2
    12-4
    13-2
    14-4
    15-12
    16-4
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello obnoxs32,

    The following macro has been added to the attached file. This will sort the data (you have already done that), count the occurrences of each number, and place the count in the cell to the right.
    Macro Code
    Please Login or Register  to view this content.
    Example
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-14-2007
    Posts
    20
    I was amazed at the operation of the macro in one of my files. I was wondering if it is possible to have this macro put a zero next to the number in the column A that I use. So that it looks like this:
    0-1
    1-2
    2-1
    3-6
    4-1
    5-1
    6-4
    7-1
    8-4
    9-3
    11-2
    12-4
    13-2
    14-4
    15-12
    16-4
    17-0
    18-0
    19-0

  4. #4
    Registered User
    Join Date
    12-14-2007
    Posts
    20
    If possible I would like to have excel go through column A to count the number of occurences like you did with the 1st Macro but using the list of 220 possible combinations attached below I would like to have a zero put next to the number if it did not occur. That way I could just copy and paste the Possibilities next to what Excel did and save the file. Hopefully it is possible.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    See macro in attached file... I hope it can help.

    Regards,
    Antonio
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-14-2007
    Posts
    20
    The macro worked just as I wanted it to... I tried looking up the coding of it under tools>macro but nothing showed up. Then I checked to see if it was in the cells but nothing showed up. Does it have something to do with the Analyze Workbook button? Can I see the coding or statements within this file? Thanks for the help!!!!
    Mike

  7. #7
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    Try with:
    right click on the sheet label 'sheet1' and then choose 'view code'.

    Regards,
    Antonio

  8. #8
    Registered User
    Join Date
    12-14-2007
    Posts
    20
    Thank you, that worked beautifully!!! I am learning more and more every day...
    Take care

+ 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