Results 1 to 5 of 5

How to count unique records?

Threaded View

  1. #1
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    How to count unique records?

    As I remember, some syntax is not allowed in this forum. I will add some "-" below.

    I can use S-QL to pull data from MS S-QL database to excel sheet.

    If I use the query S-ELECT ColumnO, ColumnP, ColumnQ, ColumnX, ColumnY, ColumnZ FROM Table_name WHERE ColumnO = 100 AND ColumnP = 10 AND ColumnQ = 30 , I will get something like below screenshot.

    I know how to put the screenshot table into excel sheet, via VBA. But this is not the final output yet. From there, I will need to calculate # of unique records, the answer is 3. I highlight them in 3 different colors. All columns have same data.

    Note: You may wonder why the output table (screen table) contains duplicate rows, because in the query, I only select 6 columns, and there are many other columns.

    All I want to get is the output number 3 , how should I modify the query to include something like COUNT/DISTINCT ? So there is no need to import raw data into excel sheet. It is possible that output result is 0

    Otherwise, I will run a VBA loop through ColumnX/ColumnY/ColumnZ and count the unique records.
    Attached Images Attached Images
    Last edited by VAer; 11-04-2024 at 06:41 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help with formula to count unique records
    By Alison913 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-08-2024, 06:26 PM
  2. [SOLVED] Count unique IDs that have multiple records
    By scubadiver007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-07-2021, 04:13 AM
  3. Count Unique records
    By guido167 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 06-23-2013, 03:08 PM
  4. Count unique records in a column
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2013, 11:51 AM
  5. Calculating Unique records row count
    By plk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-05-2012, 04:26 PM
  6. Excel 2007 : Count Unique Records
    By stevetothink in forum Excel General
    Replies: 2
    Last Post: 11-04-2011, 04:22 PM
  7. Count the number of unique records
    By [email protected] in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-08-2006, 03:35 AM

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