+ Reply to Thread
Results 1 to 12 of 12

Removes Duplicates Except Blanks macro

  1. #1
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Removes Duplicates Except Blanks macro

    How can I alter the below so that it still removes duplicates, BUT if there are 2 or more blank cells in the range, it ignores them? The blank cells will have formulas in them but they will have no value.
    Please Login or Register  to view this content.
    Last edited by ScabbyDog; 03-05-2013 at 05:16 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    So basically, it removes duplicates as normal, except it ignores blank cells completely no matter how many there are.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Removes Duplicates Except Blanks macro

    Since two blank cells are equal (Both Nil) , hence duplicates

  4. #4
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    Is that a solution or...?

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Removes Duplicates Except Blanks macro

    Yes, it is- just to confirm your thoughts.

  6. #6
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    But when i run the code it does not ignore blank cells?

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Removes Duplicates Except Blanks macro

    You said

    "except it ignores blank cells completely".

    I may be wrong, but my understanding is that if two rows are blank (I mean REAL empty), they are treated as equal, hence duplciates. This is just my opinion.

  8. #8
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    That is correct. However I want the code to ignore that and only remove duplicates in cells that are not blank. So it may possibly be a loop code that if cell x <> '''' then compare cell x against other cellsin that range and delete duplicates

  9. #9
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    Book1.xlsm

    Please find attached a sample file. When I run the macro one of the blank cells between the data are removed (cells 9 and 10). I do not want this. How can I alter it so that it fixes this?
    Last edited by ScabbyDog; 03-06-2013 at 09:23 AM.

  10. #10
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Removes Duplicates Except Blanks macro

    Maybe this

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  11. #11
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    Not quite Mike. If there are 2 or more instances of the same cell then I want to leave the first instance of the word. Also, my list of names can be any number of rows long, so it could be 18 or more depending.

  12. #12
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    Book1.xlsm

    Attached is what I have and what I want it to look life after macro runs. Bear in mind the list of names can be any length but no more than 38 rows.

  13. #13
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Removes Duplicates Except Blanks macro

    How about this

    Please Login or Register  to view this content.

  14. #14
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Removes Duplicates Except Blanks macro

    Site is acting up dupe code. Same as post #13

  15. #15
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Removes Duplicates Except Blanks macro

    Site is acting up dupe post. Same as post #13

  16. #16
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    Works fine Mike.
    I just did this too which works

    Please Login or Register  to view this content.

  17. #17
    Valued Forum Contributor
    Join Date
    03-03-2009
    Location
    UK
    MS-Off Ver
    MS365 Subscription Excel for Mac
    Posts
    1,017

    Re: Removes Duplicates Except Blanks macro

    Works fine Mike.
    I just did this too which works

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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