+ Reply to Thread
Results 1 to 7 of 7

Get unique, third smallest value in column.

  1. #1
    Registered User
    Join Date
    08-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    30

    Get unique, third smallest value in column.

    Hi,

    To find third smallest value in range (with some blank cells), I use:

    Please Login or Register  to view this content.
    That normally works but sometimes smallest and/or second smallest are duplicate values and then third smallest value will be wrong.
    As I understand it, I need to find the, unique, third smallest value but I can't find any help at different sites.
    Does anyone here know how to do that with VBA, or maybe point me in the right direction?

    Any help will be much appreciated.
    Thanks in advance!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Get unique, third smallest value in column.

    Please Login or Register  to view this content.
    Last edited by shg; 10-08-2018 at 10:28 AM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Get unique, third smallest value in column.

    If you can find the 2nd smallest and the 4th smallest, then loop through the range and find the cell with the value between those.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Get unique, third smallest value in column.

    The second- and fourth-smallest values may be the same, e.g., {1,1,1,1,1,2,3,4}

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Get unique, third smallest value in column.

    Quote Originally Posted by shg View Post
    The second- and fourth-smallest values may be the same, e.g., {1,1,1,1,1,2,3,4}
    oh yes, dar-nit.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Get unique, third smallest value in column.

    A note: That routine would be painfully slow for a large range and large-ish value of n.
    Last edited by shg; 10-08-2018 at 11:52 AM.

  7. #7
    Registered User
    Join Date
    08-10-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2016
    Posts
    30

    Re: Get unique, third smallest value in column.

    Hi shg,
    Thanks for quick reply.
    Your code works exactly as I asked but unfortunately I gave you the wrong range.
    Range is:
    Please Login or Register  to view this content.
    Is there a way to rewrite your code with this range? I tried but couldn't get it to work.
    I found a code on internet which I rewrote to this:
    Please Login or Register  to view this content.
    Not so elegant but it works.

    Thanks in advance!

+ 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] First, second and third smallest unique value in Excel
    By McFab in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-27-2018, 01:47 AM
  2. Replies: 7
    Last Post: 06-20-2016, 08:37 AM
  3. Replies: 2
    Last Post: 02-02-2015, 10:19 PM
  4. Replies: 5
    Last Post: 09-29-2011, 06:39 AM
  5. [SOLVED] Unique Smallest Value in Range
    By trandle in forum Excel General
    Replies: 1
    Last Post: 04-11-2010, 11:11 PM
  6. Returning second smallest unique value
    By proghead in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-17-2009, 02:44 PM
  7. finding 10 smallest unique values in a list
    By reggie1000 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-03-2008, 08:59 PM

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