+ Reply to Thread
Results 1 to 7 of 7

Unique count of student ids

  1. #1
    Registered User
    Join Date
    02-20-2014
    Location
    richmond,ca
    MS-Off Ver
    Excel 2013
    Posts
    4

    Unique count of student ids

    I am trying to get a unique count of student ids and the Frequency function seems to return a 0. I have attached the sheet.
    In cell C113 I am trying to get a list of all students who attended or assisted the class. Column D is the student id.

    Thanks, Michele
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Unique count of student ids

    Hi and welcome to the forum!

    Try it like this, array formula**:

    =SUM(IF(FREQUENCY(IF(($B2:$B111="Attended")+($B2:$B111="Assist"),IF($G2:$G111=$C112,MATCH(D2:D111,D2:D111,0))),ROW(D2:D111)-MIN(ROW(D2:D111))+1),1))

    Regards


    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Unique count of student ids

    =SUM(IF(FREQUENCY(IF($B$2:$B$109="Assist",IF($D$2:$D$109="Attended",IF($G$2:$G$109=$C$112,MATCH($D$2:$D$109,$D$2:$D$109,0)))),ROW($D$2:$D$109)-ROW(A3)+1),1))

    *array formula like you tried
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  4. #4
    Registered User
    Join Date
    02-20-2014
    Location
    richmond,ca
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Unique count of student ids

    This worked beautifully. Thank you.
    Can you please explain the purpose of: ROW($D1:$D104)-MIN(ROW($D1:$D104) ?
    thanks, Michele

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Unique count of student ids

    Hi,

    ROW(D2:D111)-MIN(ROW(D2:D111))+1 and ROW(D2:D111)-ROW(D2)+1 (which you will perhaps see used slightly more often these days) are constructions which generate an array of integers from 1 up to the number of rows in that range (i.e. in this case, from 1 to 110).

    Although the first of these looks overly complicated in light of the second (and it does indeed have an extra function call, the MIN), I tend to use it, partly out of habit, but also as it has some merit in the fact that if, for example, we wanted to define our range, Range1 say, then this construction could be written:

    ROW(Range1)-MIN(ROW(Range1))+1

    whereas the second would still require one 'static' reference:

    ROW(Range1)-ROW(D2)+1

    (Unless we e.g. INDEXed the range in this version.)

    Regards
    Last edited by XOR LX; 02-25-2014 at 03:28 AM.

  6. #6
    Registered User
    Join Date
    02-20-2014
    Location
    richmond,ca
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Unique count of student ids

    Thanks for the explanation.
    In instances where there are no records that meet the criteria I get a #VALUE error in the cell. Is there a simple way to set that to be blank?

    thanks, Michele

  7. #7
    Forum Expert RobertMika's Avatar
    Join Date
    06-22-2009
    Location
    Haverhill, UK
    MS-Off Ver
    Excel 2003-13
    Posts
    1,530

    Re: Unique count of student ids

    =IFERROR(SUM(IF(FREQUENCY(IF($B$2:$B$109="Assist",IF($D$2:$D$109="Attended",IF($G$2:$G$109=$C$112,MATCH($D$2:$D$109,$D$2:$D$109,0)))),ROW($D$2:$D$109)-ROW(A3)+1),1)),"")
    If you are http://www.excelforum.com/image.php?type=sigpic&userid=125481&dateline=1392355029happy with the results, please add to the contributor's
    reputation by clicking the reputation icon (star icon).




    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.
    To undo, select Thread Tools-> Mark thread as Unsolved.
    http://www.excelaris.co.uk

+ 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: 1
    Last Post: 02-06-2014, 08:07 AM
  2. Count number of Schools having Student Teacher ratio more than 30
    By maniknandi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-18-2013, 03:32 AM
  3. Replies: 10
    Last Post: 05-23-2012, 11:11 AM
  4. Replies: 0
    Last Post: 03-22-2012, 08:44 PM
  5. Replies: 17
    Last Post: 08-24-2009, 08:58 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