+ Reply to Thread
Results 1 to 10 of 10

Trying to count Unique values in every nth row of a column

  1. #1
    Registered User
    Join Date
    11-16-2020
    Location
    Central Texas
    MS-Off Ver
    Office 2016
    Posts
    8

    Trying to count Unique values in every nth row of a column

    Hello I have several columns of data that contain 3 different types of numbers, with every third number in a given column for which I want to count the number of unique values. I've tried editing existing array formulas to try to pull it off, but no luck. Is there a formula, either direct or array, that I could use to do this?

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Trying to count Unique values in every nth row of a column

    Upload an example workbook showing your layout and where you would want your formula and what results you would expect. See yellow banner at top of page.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Trying to count Unique values in every nth row of a column

    If you don't have blank cells in L5:L36, try

    =SUMPRODUCT(1/COUNTIF(L5:L36,L5:L36))

    If you do have blank cells you don't want included in the distinct count, try

    =SUMPRODUCT((1-ISBLANK(L5:L36))/(COUNTIF(L5:L36,L5:L36)+ISBLANK(L5:L36)))

    ADDED: sorry I mised the every 3rd number part.

    =COUNT(1/FREQUENCY(IF((MOD(ROW(L5:L36)-ROW(L5),3)=2)*NOT(ISBLANK(L5:L36)),MATCH(L5:L36,L5:L36,0)),ROW(L5:L36)-ROW(L5)))
    Last edited by hrlngrv; 11-16-2020 at 09:27 PM. Reason: addendum

  4. #4
    Registered User
    Join Date
    11-16-2020
    Location
    Central Texas
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Trying to count Unique values in every nth row of a column

    Please see attached fle
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Trying to count Unique values in every nth row of a column

    If you just need the number of unique numbers, I used this adaptation of hringrv's formula (thanks hringrv) in G13
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Entered as an ARRAY w/ CNTRL SHFT ENTER

    For a listing of the numbers (you want a unique list of numbers, not a listing of unique numbers), I used a helper column. In B1 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In F13 copied down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    I am not currently on O365, otherwise, I believe you could have used the UNIQUE function to simplify this.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-16-2020
    Location
    Central Texas
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Trying to count Unique values in every nth row of a column

    Hello, thanks. I tried the first formula, and it returned a result of 1. I was trying to get an answer of 9. Of the 10 numbers in that sequence, 9 are unique. Can this formula be tweaked to get the current answer?

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Trying to count Unique values in every nth row of a column

    You probably didn't enter the formula as an array. **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).

  8. #8
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Trying to count Unique values in every nth row of a column

    Quibble: ROW(A1:A30) rather than ROW(L5:L36)-ROW(L5) is fine for data beginning in row 1. Less fine when data begins further down. However, the only absolutely robust way to generate arrays of sequential integers is ROW(INDEX($1:$1048576,1,1):INDEX($1:$1048576,ROWS(RANGE),1)), which is immune to row insertion/deletion. Unless one has a version of Excel with SEQUENCE.

    As for listing distinct numbers from RANGE, why not use an advanced filter?

  9. #9
    Valued Forum Contributor
    Join Date
    10-14-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2019
    Posts
    353

    Re: Trying to count Unique values in every nth row of a column

    Maybe a pivottable can help with this.
    See attachment........
    Attached Files Attached Files
    Kind regards,
    Piet Bom

  10. #10
    Registered User
    Join Date
    11-16-2020
    Location
    Central Texas
    MS-Off Ver
    Office 2016
    Posts
    8

    Re: Trying to count Unique values in every nth row of a column

    That did the trick - thanks to all who responded!

+ 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. [SOLVED] Count number of unique values corresponding to unique data in another column
    By STUARTXL in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-26-2019, 12:32 PM
  2. [SOLVED] How to count unique distinct values from a column where values in other column exists ?
    By Daniel Tou in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-19-2017, 05:48 PM
  3. Replies: 2
    Last Post: 08-19-2015, 10:22 AM
  4. Count Unique values in Column based on values in other columns
    By dmschave in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-17-2014, 11:06 AM
  5. Replies: 8
    Last Post: 05-15-2013, 04:50 PM
  6. [SOLVED] Macro to count unique values in a column, enter it in next column, then delete duplicates
    By pmorisse in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2013, 03:27 PM
  7. Count Unique Values In One Column Basis Unique Values in Another Column
    By shez_raz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2012, 01:55 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