+ Reply to Thread
Results 1 to 6 of 6

Sort unique values in column while ignoring empty/blank cells

  1. #1
    Forum Contributor
    Join Date
    07-01-2009
    Location
    Maine, USA
    MS-Off Ver
    Excel 2016
    Posts
    161

    Sort unique values in column while ignoring empty/blank cells

    I have a column with data (mostly names) that looks like this...

    Joe
    Tom
    Microsoft
    Tom
    Sue
    Mark
    Mark

    I would like for it to ignore empty/blank cells so I end up with a column that looks like:

    Joe 1
    Mark 2
    Microsoft 1
    Sue 1
    Tom 2

    Any help would be appreciated. Please note that in the preview, the table did not show distinct blank/empty rows.

  2. #2
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,998

    Re: Sort unique values in column while ignoring empty/blank cells

    A
    B
    C
    D
    E
    1
    list unique list
    2
    Joe Joe
    1
    3
    Tom Mark
    2
    4
    Microsoft Microsoft
    1
    5
    Sue
    1
    6
    Tom Tom
    2
    7
    8
    9
    Sue
    10
    Mark
    11
    Mark











    D2=IFERROR(INDEX(A$2:A$100,MATCH(0,INDEX(COUNTIF(A$2:A$100,"<"&A$2:A$100)-SUMPRODUCT(COUNTIF(D$1:D1,A$2:A$100)),),0)),"")

    Copy down

    E2=IF($D2<>"",COUNTIF($A$2:$A$100,$D2),"")

    copy down

  3. #3
    Forum Contributor
    Join Date
    07-01-2009
    Location
    Maine, USA
    MS-Off Ver
    Excel 2016
    Posts
    161

    Re: Sort unique values in column while ignoring empty/blank cells

    Caracalla,

    It works perfectly! I would like to expand on what you provided. If column B had a status like 'open' or 'closed, and F1 was 'open' and G1 was 'closed', how can I use D2 to then count how many instances of Mark are open/closed? It should know that if column A5 or D8 are empty, then not to count anything.

    Thinking something like: if A2:A11 = D2 then count where B2:B11 = F1
    Last edited by mainemojo; 10-15-2019 at 02:42 PM.

  4. #4
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,998

    Re: Sort unique values in column while ignoring empty/blank cells

    A
    B
    C
    D
    E
    F
    G
    1
    list unique list OPEN CLOSED
    2
    Joe OPEN Joe
    1
    0
    3
    Tom CLOSED Mark
    1
    1
    4
    Microsoft OPEN Microsoft
    1
    0
    5
    Sue
    0
    1
    6
    Tom CLOSED Tom
    0
    2
    7
    8
    9
    Sue CLOSED
    10
    Mark OPEN
    11
    Mark CLOSED


    F2=IF($D2<>"",COUNTIFS($A$2:$A$100,$D2,$B$2:$B$100,F$1))

    Copy across and down

  5. #5
    Forum Contributor
    Join Date
    07-01-2009
    Location
    Maine, USA
    MS-Off Ver
    Excel 2016
    Posts
    161

    Re: Sort unique values in column while ignoring empty/blank cells

    I finally figured out the COUNTIFS portion, but couldn't figure out how to add the "". I had to change the formula to

    F2=IF($D2<>"",COUNTIFS($A$2:$A$100,$D2,$B$2:$B$100,F$1),"")

    If I didn't add the ,"" at the end, I would have ended up with FALSE in F7:G11.
    Last edited by mainemojo; 10-15-2019 at 03:00 PM.

  6. #6
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,998

    Re: Sort unique values in column while ignoring empty/blank cells

    Sorry
    I forgot "" in the formula

    F2=IF($D2<>"",COUNTIFS($A$2:$A$100,$D2,$B$2:$B$100,F$1),"")

+ 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. How to find last cells in a column (ignoring empty space in a cell)?
    By niuyuer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2016, 03:36 PM
  2. Forecast Formula - Ignoring Blank/Empty Cells
    By prudential in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-25-2015, 12:19 PM
  3. Ignoring blank Cells while Fetching Values
    By Parthan in forum Excel General
    Replies: 1
    Last Post: 08-23-2014, 11:06 AM
  4. [SOLVED] Sort columns ignoring blank cells
    By maldonadocj in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-16-2014, 07:02 AM
  5. Ignoring Blank Cells in an Ascending Sort VBA Code
    By Simon.Ward in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-24-2013, 11:36 AM
  6. Excel 2007 : Sort data whilst ignoring blank cells
    By Klara in forum Excel General
    Replies: 1
    Last Post: 10-06-2011, 07:21 AM
  7. [SOLVED] Ignoring Blank/Empty Cells that contain formulas
    By pabown in forum Excel General
    Replies: 4
    Last Post: 01-25-2005, 06:06 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