+ Reply to Thread
Results 1 to 10 of 10

Array Formula that will alphabetically sort and remove blanks but keep the duplicates

  1. #1
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Question Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    I have been searching for a formula that would alphabetically sort a range with numbers, text and blank cell. I did find this formula:

    https://www.get-digital-help.com/200...ange-in-excel/

    Please Login or Register  to view this content.
    This formula would extract the data and sort it alphabetically
    and remove the blanks but will also delete the duplicates. I want a formula that will keep the duplicates.

    Thank you in advance!!

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,578

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    Try this array entered formula*, it sorts, removes blanks and leaves duplicates:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    *Array entered formulas are confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.
    If the formula doesn't do what you want I would suggest uploading a spreadsheet that shows the unsorted data and then a manually produced column showing how you would like it to be sorted, so that we may attempt to duplicate the manually produced results using formula(s) and/or code.
    To upload a spreadsheet click on the GO ADVANCED button below the Quick Reply window and then scroll down to Manage Attachments to open the upload window.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    Thank you JeteMC for your code. I was wondering if I could take it a step further and apply this formula to cell that references to another workbook. When I apply this code onto cells that reference to another workbook, I would get blanks first then later the sorted data. I attached an example of what I am doing. Is there a way to get the sorted data first?

    In the sort.xlsx, Sheet1 A1:H15 is the original inputted data. In Sheet2, A1:H15 is reference to Sheet1's A1:H15 and Sheet2's J1:J739 is the code you provided. J1:J86 are blanks but starting from J87:J120, I get the sorted data.

    Thank you
    Attached Files Attached Files
    Last edited by RXcel; 01-17-2018 at 12:03 AM. Reason: Expanding the question

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,578

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    I believe that the reason for the blanks in column J was because the formula is referencing cells with formulas in them.
    When you create a table (tbl) from the range on sheet 1 and use the formula from post #2 in column J of sheet 2 to reference that table the first value in the column is 'a' as expected.
    The formula will work with regular range references (i.e. Sheet1!A$2:H$16) also, as is modeled in column K on sheet 2.
    Let us know if you have any questions.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    Thank JeteMC for replying. The reason why I didn't create a table (tbl) or refer to sheet1 is because in sort.xlsx, I am pretending sheet1 as several different external workbooks and in sheet2 as the master workbook that draws the data from sheet1 (pretending to be several different workbooks). Is it still possible to sort the data using the formula you provided in post #2? I actually tried copying the formula's results and pasting the value but when I sort the pasted value, it moves everything that has a results and moves it to the end. Thank you so much!

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    Dear RXcel,
    In you attached file both the sheets looks like same

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  7. #7
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    Sorry for not providing better example.

    Attached are examples of what I am trying to achieve. Inventory 1 to 3 are given to people to fill out, while the Master.xlsx has a cell that allow the user to input the date and return what was sold on that date for each person.

    The sorted list result in Master.xlsx will start at row 43 for 1/17/18 and 44 for 1/18/18.

    Thank you.
    Attached Files Attached Files

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    E4=TEXT(INDIRECT("R"&TEXT(RIGHT(LARGE(INDEX(0+(COUNTIF($A$4:$C$100,">="&$A$4:$C$100)&TEXT(ROW($A$4:$C$100),"0000")&TEXT(COLUMN($A$4:$C$13),"000")),0),ROWS(E$4:E4)),7),"0000\C000"),0),"#")
    Please Login or Register  to view this content.
    Try the above in Your Master file copy towards down

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    Thanks for adding rep.
    if it takes care of your post please Don't forget to mark this thread as "Solved" (Thread Tools->Mark thread as Solved)

  10. #10
    Registered User
    Join Date
    09-13-2017
    Location
    United States
    MS-Off Ver
    MS Office 365
    Posts
    43

    Re: Array Formula that will alphabetically sort and remove blanks but keep the duplicates

    Thank you nflsales! The formula you provided works. Can you explain how you came up with the formula? Thank you!!

+ 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. Need to sort a list alphabetically ignoring blanks
    By john dalton in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-02-2016, 10:30 AM
  2. [SOLVED] Sort results of INDEX/MATCH array formula remove blanks. . .
    By PeteABC123 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-14-2014, 01:53 PM
  3. [SOLVED] Using an array formula to sort alphabetically over multiple columns
    By AliGW in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 02-14-2014, 02:13 PM
  4. VBA n00b, need HELP for work - Sort alphabetically, independantly, duplicates together
    By SnyperBunny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2013, 06:10 PM
  5. [SOLVED] Remove duplicates and sort array
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 35
    Last Post: 10-11-2012, 10:22 AM
  6. Array formula to remove blanks (like autofilter)
    By CST in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-13-2012, 12:54 PM
  7. Array formula to remove blanks needs to work in 2003
    By Chinchin in forum Excel General
    Replies: 3
    Last Post: 08-26-2011, 09:15 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