+ Reply to Thread
Results 1 to 8 of 8

Count Unique Names across multiple columns for specific date

  1. #1
    Registered User
    Join Date
    12-17-2013
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2013
    Posts
    10

    Count Unique Names across multiple columns for specific date

    I need a formula that can count the number of staff on duty during a specific date. Each staff is used for different students throughout the day but i only need their name counted once. I have found some formulas that will count from 1 column but not all 6 at once.

    Is this possible? Any help or suggestions are welcomed.

    Thanks in advance!!!

    attached is a worksheet.
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Count Unique Names across multiple columns for specific date

    Hi Kattie,

    I can do this problem but it takes some tools. The first thing to do is to "UnPivot" your data so the staff are all in the same column. I did this using a "Power Query" UnPivot function. If you don't have the Power Query Add-In you can install it from:
    https://www.microsoft.com/en-us/down...c-c1f269050d5c

    Then I created two columns next to the unpivoted data. The first appended the Date and Staff. The second did a countif from the top to show duplicates of the same date and staff.

    Then I created a pivot table where I filtered your data only showing a 1 on the count from the top. This is then the number you wanted.

    I'm sorry it is a little involved but learning how to Unpivot and then the Helper Column (from the top) are great tools to add to your Excel toolbox.
    See my answer attached.
    Unpivot then Count Unique DateStaff.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    12-17-2013
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Count Unique Names across multiple columns for specific date

    I can't unpivot the data, i need it in that order for the report i am working on.

    is there any other way?
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Count Unique Names across multiple columns for specific date

    Hello
    I was working on this when Marvin replied. If you can't use Marvin's Pivot option, then perhaps you could adapt this formula method. The formula uses as dynamic named range (rng) and assumes that the dates are grouped together as in your example. Conditional formatting highlights the selected range to check the count. If I've understood you correctly, it seems to give the correct count.

    DBY
    Attached Files Attached Files
    Last edited by DBY; 10-21-2016 at 02:59 PM. Reason: Amended attachment

  5. #5
    Registered User
    Join Date
    12-17-2013
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Count Unique Names across multiple columns for specific date

    thank you but that way is counting the students and i only need the staff counted, and i am going to be adding more columns

  6. #6
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Count Unique Names across multiple columns for specific date

    Yes. Sorry. I've amended the attachment. This would be the new formula for the dynamic range:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    There can be nothing in the first header row but the headers you add unless you restrict the COUNTA function.

    'Date' is another dynamic range to add dates in column A. Same principle as the header row applies here.
    Last edited by DBY; 10-22-2016 at 11:01 AM. Reason: typo

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count Unique Names across multiple columns for specific date

    This is rather cumbersome. I couldn't find a way to do the same dynamic range with OFFSET. It would be more compact.

    Array entered in L2 and filled down in your last upload. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    =SUM((INDEX($C$2:$H$144,MATCH(1,1/(K2=$A$2:$A$144),0),):INDEX($C$2:$H$144,MATCH(2,1/(K2=$A$2:$A$144),1),)<>"")/COUNTIF(INDEX($C$2:$H$144,MATCH(1,1/(K2=$A$2:$A$144),0),):INDEX($C$2:$H$144,MATCH(2,1/(K2=$A$2:$A$144),1),),INDEX($C$2:$H$144,MATCH(1,1/(K2=$A$2:$A$144),0),):INDEX($C$2:$H$144,MATCH(2,1/(K2=$A$2:$A$144),1),)&""))
    Dave

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count Unique Names across multiple columns for specific date

    Here is a simpler formula than my previous post. Also in L2 and filled down. It does not need to be array entered.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    =SUMPRODUCT((OFFSET(INDEX($C$2:$C$144,MATCH(K2,$A$2:$A$144,0)),0,0,COUNTIF($A$2:$A$144,K2),6)<>"")/COUNTIF(OFFSET(INDEX($C$2:$C$144,MATCH(K2,$A$2:$A$144,0)),0,0,COUNTIF($A$2:$A$144,K2),6),OFFSET(INDEX($C$2:$C$144,MATCH(K2,$A$2:$A$144,0)),0,0,COUNTIF($A$2:$A$144,K2),6)&""))
    Last edited by FlameRetired; 10-22-2016 at 10:09 PM.

+ 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. sum unique names with specific date
    By graybush in forum Excel General
    Replies: 8
    Last Post: 05-03-2021, 12:05 AM
  2. vba find unique names in multiple columns
    By Konexcelmath in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2014, 09:10 PM
  3. [SOLVED] Sort and Count Unique List Across Multiple Columns - Student Count
    By BuntyMac in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 08-17-2014, 07:00 AM
  4. Replies: 6
    Last Post: 05-12-2014, 09:16 PM
  5. [SOLVED] Count unique values on a specific date
    By Even in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-21-2014, 02:05 PM
  6. Unique Names from Multiple Columns
    By par0016 in forum Excel General
    Replies: 4
    Last Post: 01-23-2013, 01:26 AM
  7. Count unique records for a specific date
    By Mallycat in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-22-2010, 07:13 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