+ Reply to Thread
Results 1 to 8 of 8

Is column Sorted, with possible duplicates

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,959

    Is column Sorted, with possible duplicates

    I've been looking all over, with no success. I want either a formula or a VBA function to determine if a column is sorted. I've attached the best candidates I've found, both a formula and function based on that formula. However, while it works well to tell me if a column is sorted, it fails if the column contains duplicates. Is there a way to determine if a column of values, which may or may not contain duplicates, is sorted alphabetically?

    I appreciate any help I can get.
    Attached Files Attached Files
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,124

    Re: Is column Sorted, with possible duplicates

    How about
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,959

    Re: Is column Sorted, with possible duplicates

    Much Better! However, the function only shows it's sorted if it's A-Z, Z-A results in Unsorted. is there a way to show either version as sorted?

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,124

    Re: Is column Sorted, with possible duplicates

    How about
    Please Login or Register  to view this content.
    Used like IsRangeSorted(B2:B25,"Z")
    for sorting Z to A

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,959

    Re: Is column Sorted, with possible duplicates

    Hmmm. I hate having to decide between two good options. While I like the option of being able to choose what sort I want to check for, my immediate use for this is in another macro where I want to highlight rows containing duplicate values in alternating colors. Of course that kind of highlighting only makes sense if the data is sorted, so I need to check to ensure the data is sorted, but in this context it doesn't matter if it is ascending or descending.

    I think you've given me enough to enable me to take it from here. Thank you SO MUCH for doing the hard work and pointing me in the right direction!

  6. #6
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,959

    Re: Is column Sorted, with possible duplicates

    Fluff13,
    I tried to Add Reputation, but it tells me I need to spread some around before I give to you again. Apparently you're working WAY too hard! Thanks.

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,959

    Re: Is column Sorted, with possible duplicates

    Fluff13, it took me a little bit, but I think I've got it working to do either way. if the first condition results in UNSORTED, then we check the second. Feel free to suggest any improvements I could do to it, but so far this seems to be doing the trick. All your idea.

    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,124

    Re: Is column Sorted, with possible duplicates

    Glad you sorted it & thanks for the feedback

+ 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] Add up quantitites in Column E based on duplicates in Column A, then delete duplicates
    By eli-vergara in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-02-2016, 05:44 PM
  2. Replies: 4
    Last Post: 09-15-2014, 06:01 AM
  3. [SOLVED] How to make a sorted list Column by Column using array formula
    By turist in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-09-2013, 11:11 AM
  4. [SOLVED] Find duplicates in column A, add values from column B (possibly delete duplicates)
    By luarwhite in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2013, 04:34 PM
  5. Replies: 1
    Last Post: 05-06-2013, 06:28 AM
  6. [SOLVED] have a column of random dates. want a formula for an output column of them sorted
    By James C in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-03-2013, 04:24 PM
  7. Replies: 0
    Last Post: 02-13-2006, 04:45 PM

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