+ Reply to Thread
Results 1 to 3 of 3

Macro to count unique values in a column with pop up message box - sheet will be filtered

  1. #1
    Registered User
    Join Date
    04-16-2014
    Location
    vancouver
    MS-Off Ver
    Excel 2007
    Posts
    18

    Macro to count unique values in a column with pop up message box - sheet will be filtered

    Hi,

    I'm trying to find a way to count the unique values in a specific column. I'd like to have a macro where I press a "Count" button and a message box pops up with the number. The sheet will be filtered based on values in other columns and the number of unique values will need to reflect the updated total.

    I've attached a sheet with the unique values that need to be counted in column E. The sheet will be filtered by column B.

    If you have any suggestions or advice, I'd really appreciate it. Thanks!

    Graham
    Attached Files Attached Files

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Macro to count unique values in a column with pop up message box - sheet will be filte

    try the following macro:
    Please Login or Register  to view this content.
    It actually counts the visible cells in column E. You can change the column as you'd like.

    Or you can also use this macro to check how many unique combinations of 2 or more columns of data exist in the filtered data. See modified macro below:
    Please Login or Register  to view this content.
    In fact, a Scripting Dictionary will store any values you want only once. It can't store it twice. That's why we use it to count unique values in a range like here. So you can concatenate any number of cells as you want to create a unique search pattern
    Last edited by p24leclerc; 05-26-2014 at 07:36 PM.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    04-16-2014
    Location
    vancouver
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Macro to count unique values in a column with pop up message box - sheet will be filte

    Thanks, Pierre! That second macro is exactly what I needed. The first code is counting the visible cells with values but the second one is counting the unique values and works perfectly.

    Thanks again!
    Graham

+ 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 unique, visible values in a filtered column
    By kajakk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-07-2013, 08:42 AM
  2. count unique values in filtered column
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-09-2013, 10:40 AM
  3. Needa a formulat to count unique values in a filtered column
    By rabustam04 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-27-2012, 01:13 PM
  4. Count Unique Values in a Filtered Column
    By mashley in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-30-2008, 10:56 AM
  5. Count Unique Values In A Filtered Row with Duplicates
    By jcpotwor in forum Excel General
    Replies: 1
    Last Post: 01-12-2006, 09:10 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