+ Reply to Thread
Results 1 to 12 of 12

Extract unique values excluding blank cells

  1. #1
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    267

    Extract unique values excluding blank cells

    I am seeking help with a simple VBA code

    Scenario

    Column header is in cell Q4

    Data is in Q5:Q204 (including multiple blank cells)

    I want the unique values listed downwards from AH5 with the same column header in AH4... Blank Cells in Q5:Q204 should be excluded when extracting the unique values in column AH...

    If the unique values in AH can be sorted ascending... even better

    Thanks in advance
    Regards,
    Navin Agrawal

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Extract unique values excluding blank cells

    Hi Navin,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    267

    Re: Extract unique values excluding blank cells

    Quote Originally Posted by Trebor76 View Post
    Hi Navin,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    Thanks Robert... It returns an error... attaching a spreadsheet
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    267

    Re: Extract unique values excluding blank cells

    Quote Originally Posted by Trebor76 View Post
    Hi Navin,

    Try this:

    Please Login or Register  to view this content.
    Regards,

    Robert
    Hello Robert,

    The solution suggested by you is returning an error...

    My apologies for attaching an incomplete sample sheet... Attached is the correct sheet....
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Extract unique values excluding blank cells

    The solution suggested by you is returning an error...
    That's odd - it works for me At a guess I'd say you're running the macro not from the sheet with the data and so here's a slight variation of my original code to accommodate for that:

    Please Login or Register  to view this content.
    If it still errors out I need to what line and what error details (number and description) you are getting to be able to help further.

    Thanks,

    Robert
    Last edited by Trebor76; 08-18-2021 at 01:05 AM.

  6. #6
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    267

    Re: Extract unique values excluding blank cells

    Quote Originally Posted by Trebor76 View Post
    That's odd - it works for me At a guess I'd say you're running the macro not from the sheet with the data and so here's a slight variation of my original code to accommodate for that:

    Please Login or Register  to view this content.
    If it still errors out I need to what line and what error details (number and description) you are getting to be able to help further.

    Thanks,

    Robert
    Many thanks Robert... This works... just a couple of things not happening...

    This Macro is pasting the unique values.... but distorting the fonts & formatting...

    The range AI6:AP204 is not being cleared before pasting the formula in AI5:AP5 in the rows below, based on the number of unique values.... thus the formulas in the extra rows continue to be there...

    The graphs not happening...

    Attaching the sheet again.... If you can help... it will be a big, big favor...

    Many Thanks once again...
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Extract unique values excluding blank cells

    Different method.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Extract unique values excluding blank cells

    I have put the following code here as a way for others to use it if they can't download it and also on the attached workbook as a way prove it also works without issue:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    267

    Re: Extract unique values excluding blank cells

    Quote Originally Posted by Trebor76 View Post
    I have put the following code here as a way for others to use it if they can't download it and also on the attached workbook as a way prove it also works without issue:

    Please Login or Register  to view this content.
    Many many many thanks Robert.... God bless you...

    Would like to point out a couple of things...

    1) The first graph on the sheets GRAPHS is an image and not an excel ... so it is not getting updated....

    2) The legends in the pie chart are over-lapping the graph if the number of items increases... how do we shift the pie chart to the left corner?

    Attaching your file again for reference...

    what is the difference between .xlsm and .xlsb format?

    Many thanks again...
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Extract unique values excluding blank cells

    1) The first graph on the sheets GRAPHS is an image and not an excel ... so it is not getting updated....
    Note sure how that happened but it's a chart now

    2) The legends in the pie chart are over-lapping the graph if the number of items increases... how do we shift the pie chart to the left corner?
    Just click and drag the chart(s) to where ever you each them on the tab (I moved the second chart to be beside the first). You also size them this way as well.

    what is the difference between .xlsm and .xlsb format?
    xlsb files are smaller and Excel tends to run these files faster. Their downside is that they are not as compatible with other applications. There's plenty of articles about these different file types on the net.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-15-2012
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2007
    Posts
    267

    Re: Extract unique values excluding blank cells

    Quote Originally Posted by Trebor76 View Post
    Note sure how that happened but it's a chart now



    Just click and drag the chart(s) to where ever you each them on the tab (I moved the second chart to be beside the first). You also size them this way as well.



    xlsb files are smaller and Excel tends to run these files faster. Their downside is that they are not as compatible with other applications. There's plenty of articles about these different file types on the net.
    Thank you very much Robert... Appreciate your help... I am closing this thread and rating you / recommending you with highest stars / numbers

  12. #12
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Extract unique values excluding blank cells

    You're welcome and 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. [SOLVED] Populating blank cells for unique values (if there's something to populate)
    By mike_vr in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-07-2019, 10:42 AM
  2. [SOLVED] Count unique text values with blank cells
    By Excelski in forum Excel General
    Replies: 1
    Last Post: 07-27-2017, 04:26 AM
  3. [SOLVED] Counting unique cells - totally excluding duplicate values
    By ChanceLipscomb in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-26-2016, 12:44 PM
  4. [SOLVED] Looking for final four values in range, excluding any blank cells
    By OffTheFairway22 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-02-2015, 07:32 AM
  5. Averaging values while excluding blank cells
    By J. M. Hardiman in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-11-2014, 11:44 AM
  6. Replies: 1
    Last Post: 04-11-2013, 01:02 PM
  7. How do I use countif to count values excluding blank cells
    By Glenda in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2006, 12:30 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