+ Reply to Thread
Results 1 to 7 of 7

UDF for removing duplicate ignoring blank row

  1. #1
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    UDF for removing duplicate ignoring blank row

    I have data from A1 to A15 in a sheet. I wish to create a user defined function with name and syntax as Unqval(data_range).
    data_range is the range where the values are present

    eg: If I use the formula in D1 as Unqval(A1:A15), it should return unique values of data from cell D1 downwards by checking, A1 to A15. It should ignore blank rows and also sort in descending order. The illustration is as shown

    I know how to get the unique values by formula which is as follows.
    Please Login or Register  to view this content.
    But, the data returned in Col. D cannot be used further. Also, it does not ignore blank rows also. Hence, I desire a VBA solution.
    Attached Images Attached Images

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: UDF for removing duplicate ignoring blank row

    50 posts and still posting screenshot only? No workboiok as attachment?

    So let me paste one of our canned replies:
    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.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    Re: UDF for removing duplicate ignoring blank row

    Workbook attached.
    Attached Files Attached Files

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: UDF for removing duplicate ignoring blank row

    Have a lok on such code:

    Please Login or Register  to view this content.

    Usage:

    Select enough or more cells than needed for output (for instance F2:F10 - see what happens when too few are selected - orange cells)
    With these few cells selected (not just one) write formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and commit as array formula - 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.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-05-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    78

    Re: UDF for removing duplicate ignoring blank row

    This is much complex than I thought.

    As Unqval is an array function, I am not able to use the output data for further processing. Also, selection of the output data range is cumbersome. How can we get the data type of the original data preserved in the final sorted output? Also, would it be better to modify the UDF as Unqval(datainput_range, dataoutput_range) so that the exercise of entering the formula as array can be avoided.

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: UDF for removing duplicate ignoring blank row

    UDF only returns value in cells it is called, so no way to do Unqval(datainput_range, dataoutput_range) working as you expect. :-(

    Of course you can do it in VBA procedure, but works as standar excel function.

    So you may try:

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: UDF for removing duplicate ignoring blank row

    Coming back to UDF concept:

    How about regular (not array) formula in worksheet in F2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    to be copied down.
    Second argument is range with already listed values so if there is nothing in F1 (or header, which is not in columnA it returns Highest value in A1:A15. Copied down to F3 it becomes
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    so lists second highest item (first is listed in F2) etc?

    The code for such UDF is:
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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: 2
    Last Post: 03-03-2018, 05:00 AM
  2. [SOLVED] How to count all of duplicate value by ignoring blank cells?
    By putritersenyum in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-30-2017, 12:31 PM
  3. Replies: 3
    Last Post: 07-24-2017, 01:41 PM
  4. Finding only duplicate while ignoring blanks
    By pyropygmy in forum Excel General
    Replies: 3
    Last Post: 02-14-2016, 05:06 PM
  5. [SOLVED] Help ignoring duplicate data
    By jtmoore in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 07-11-2014, 06:21 PM
  6. [SOLVED] Polulating another tab/sheet bsaed on a criteria, but ignoring/removing blanks
    By gusman2x in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-26-2014, 01:45 PM
  7. How do I do count calculations ignoring duplicate values
    By Robin Faulkner in forum Excel General
    Replies: 1
    Last Post: 03-31-2005, 12:06 PM

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