+ Reply to Thread
Results 1 to 5 of 5

Sorting a text column while ignoring blank cells

  1. #1
    Registered User
    Join Date
    08-30-2013
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    3

    Sorting a text column while ignoring blank cells

    Hello,

    I need to sort a text column and ignore (or put at the end of the sorted column) all blank cells. I've been using this formula to sort so far (entered with Ctrl-Shift-Enter as an array formula):

    =IF(ROWS($B$1:B1)<=COUNTA(NAMES);
    INDEX(NAMES;MATCH( SMALL(COUNTIF(NAMES;"<"&NAMES);ROWS($B$1:B1)); COUNTIF(NAMES;"<"&NAMES); 0));
    "")

    (Please note I'm using semicolons instead of commas)

    The above formula would sort a named range called NAMES in column A like this in column B:

    Please Login or Register  to view this content.

    But there's a problem if the named range has blank cells in the end, then the first name is repeated in the sorted column as many times as the blank cells, at the expense of the last ones that disappear, like this

    Please Login or Register  to view this content.

    How can I achieve the desired result which is the following ?

    Please Login or Register  to view this content.

    Thank you in advance!
    Last edited by mic2mic; 08-30-2013 at 04:48 AM. Reason: Solved

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sorting a text column while ignoring blank cells

    Hi there.Καλημέρα Πατρίδα!

    Assuming that you data are in column A, highlight column A and insert a new column. So now your data will be in column B, starting in B2.

    So in A2 and copy down put this.

    =COUNTIF($B$2:$B$21;"<="&B2)

    This will be a helper and hidden column.

    Now in C2 and copy down, use this one.

    =IFERROR(VLOOKUP(ROW()-ROW($C$1);$A$2:$B$21;2;FALSE);"")

    Comments?
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Sorting a text column while ignoring blank cells

    welcome to the forum, mic2mic. here's another alternative:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    array formula too. here's the explanation:
    http://www.get-digital-help.com/2009...mula-in-excel/

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Registered User
    Join Date
    08-30-2013
    Location
    Greece
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Sorting a text column while ignoring blank cells

    Quote Originally Posted by Fotis1991 View Post
    Hi there.Καλημέρα Πατρίδα!
    Καλημέρα κι ευχαριστώ πολύ! Thanks!

    Quote Originally Posted by benishiryo View Post
    welcome to the forum, mic2mic. here's another alternative:
    Now, this is damn sleek. Why didn't my google-foo come up with this ? Thanks!

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Sorting a text column while ignoring blank cells

    You are welcome and thanks for the feed back.

    If you google.. for excel uniques..., it's 100% sure that will provide the suggested ny Ben site. It is 1 of the best!!

+ 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. Replies: 12
    Last Post: 03-04-2015, 04:28 PM
  2. Replies: 7
    Last Post: 07-02-2012, 07:23 PM
  3. [SOLVED] Problem sorting column that has blank cells with formulas
    By timmyjc18 in forum Excel General
    Replies: 3
    Last Post: 06-20-2012, 02:10 PM
  4. Help with ignoring blank cells when drawing a column chart
    By Iibboh in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-13-2012, 04:24 PM
  5. calculating data in a column, while ignoring cells with text in them.
    By jousley in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-10-2010, 02:03 AM

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