+ Reply to Thread
Results 1 to 6 of 6

Macro code to count number of unique rows in a sheet.

  1. #1
    Registered User
    Join Date
    02-05-2013
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    25

    Smile Macro code to count number of unique rows in a sheet.

    Hi Forum,

    I was trying to design a macro which should count the unique rows in the sheet and should display them accordingly. (Possibly in second sheet).

    I'll just give a quick example for this scenario

    Sheet 1:
    String Age
    str1 5
    str1 5
    str1 3
    str1 3
    str1 3
    str2 5


    When I run a macro now I should get the results as follows in sheet 2:

    Sheet 2:
    String Age Count
    str1 5 2
    str1 3 3
    str2 5 1

    Can anyone help me in designing macro for this. Thanks for your help.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro code to count number of unique rows in a sheet.

    Better use Pivot Table which will do the same job which you shown above...


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    02-05-2013
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Macro code to count number of unique rows in a sheet.

    Thanks for the prompt reply Sir. The thing is I am a newbie to the VBA and pivot. Can you please explain the steps so that I can follow it accordingly.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro code to count number of unique rows in a sheet.

    Refer the attached file for Pivot Solution.

    To know about how to use pivot table please do a google search you will get lot of online materials with step by step instructions.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-05-2013
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Macro code to count number of unique rows in a sheet.

    Thanks Sir.

  6. #6
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Macro code to count number of unique rows in a sheet.

    Glad it helps you and thanks for the feedback

+ 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. Replies: 2
    Last Post: 06-11-2014, 11:14 AM
  2. [SOLVED] Need VBA code to count number of rows & split into group of 7 rows in same sheet
    By amy_d2 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-05-2013, 11:03 AM
  3. Need to Count number of unique rows for desired value
    By peterszabla in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-28-2013, 09:02 PM
  4. Replies: 1
    Last Post: 11-19-2012, 04:16 PM
  5. Macro: Count rows in sheet A, copy count in sheet B, paste offset in sheet A
    By Agent:Orange in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2011, 07:56 AM

Tags for this Thread

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