Consulting

Results 1 to 8 of 8

Thread: Formula for finding unique values

  1. #1

    Formula for finding unique values

    Do you know what formula to use in tis example if I want to find a unique value in column B?Book1.xlsx

  2. #2
    VBAX Mentor
    Joined
    Nov 2020
    Location
    Cochin, Kerala
    Posts
    314
    Location
    =UNIQUE(B2:B11)
    Currently the UNIQUE function is only available with Office 365 subscriptions. Excel 2019, Excel 2016, Excel 2013 and earlier do not support dynamic array formulas, so the UNIQUE function is not available in these versions.

  3. #3
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  4. #4
    Thanks for your advice

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If you don't have Office 365 and the UNIQUE function, try this.

    In cell D2, enter -
    =B2

    In cell D3, add this array formula -
    =IFERROR(IF(INDEX($B$2:$B$100,MATCH(0,COUNTIF(D$2:D2,$B$2:$B$100&""),0))=0, "",INDEX($B$2:$B$100,MATCH(0,COUNTIF(D$2:D2,$B$2:$B$100&""),0))),"")

    copy D3 down as far as you need.
    Last edited by Bob Phillips; 10-12-2021 at 11:27 AM.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    FYI, the is 'translated' by the forum software. It really is ":D". i.e. part of the range specification

    Took me awhile long ago to figure out why Ranges were laughing at me
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  7. #7
    VBAX Mentor
    Joined
    Nov 2020
    Location
    Cochin, Kerala
    Posts
    314
    Location
    Thanks Bob for this formula and thanks Paul for clarifying the range converted into smiley
    Just a doubt - Is there any specific reason for having &"" in the count if formula
    COUNTIF(D$2:$D2,$B$2:$B$100&"")

  8. #8
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Sorry about the smilies, I should look at my posts after I post them :-)

    Quote Originally Posted by anish.ms View Post
    Just a doubt - Is there any specific reason for having &"" in the count if formula
    COUNTIF(D$2:$D2,$B$2:$B$100&"")
    It is there so as to handle the case where there are blank cells in the data.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •