+ Reply to Thread
Results 1 to 4 of 4

Thread: Calculate number of unique values in non adjacent cells

  1. #1
    Registered User
    Join Date
    06-16-2011
    Location
    England
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    6

    Calculate number of unique values in non adjacent cells

    Hello

    I need to calculate the number of unique cells within a range of approximately 190 non adjacent cells.

    The cells are all in the same column but every other row i.e. C14, C16, C18, C20 etc.

    The cells contain text of client references compromising both letters and numbers, together with some blank cells that need ignoring.

    I have found a way of doing it if all the cells are adjacent in a column but am struggling with non adjacent cells.

    In the worksheet I have grouped and named all the cells that need considering 'clients', and I was hoping for a formula (possibly utilising the name) to return the number of unique cells.

    In the attached file the coloured cells are the ones that need considering (the blank ones would ordinarily have other unrelated data in) and the number returned in this case would be 5.

    The cells form part of a much more extensive spreadsheet so unfortunately rearranging them so they are in adjacent cells is not a possibility.

    Any ideas very gratefully received - I just hope it is possible !


    Many thanks

    MRF
    Attached Images Attached Images
    Last edited by MRF1974; 01-24-2012 at 03:59 PM.

  2. #2
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Calculate number of unique values in non adjacent cells

    Try:

    =COUNT(1/FREQUENCY(IF(MOD(ROW(A1:A11),2)=1,IF(A1:A11<>"",MATCH(A1:A11,A1:A11,0))),ROW(A1:A11)-MIN(ROW(A1:A11))+1))
    adjust ranges to suit.

    This assumes you are checking every odd row starting at A1, if you want even rows, change the MOD()=1 to MOD()=0

    Then Confirm the formula with CTRL+SHIFT+ENTER not just ENTER
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: Calculate number of unique values in non adjacent cells

    Try:

    =COUNT(1/FREQUENCY(IF(MOD(ROW(A1:A11),2)=1,IF(A1:A11<>"",MATCH(A1:A11,A1:A11,0))),ROW(A1:A11)-MIN(ROW(A1:A11))+1))
    adjust ranges to suit.

    This assumes you are checking every odd row starting at A1, if you want even rows, change the MOD()=1 to MOD()=0

    Then Confirm the formula with CTRL+SHIFT+ENTER not just ENTER
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  4. #4
    Registered User
    Join Date
    06-16-2011
    Location
    England
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    6

    Re: Calculate number of unique values in non adjacent cells

    Thanks NBVC - much appreciated.

    Code works perfectly.

    Thanks again.

    MRF

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0