+ Reply to Thread
Results 1 to 7 of 7

Get Unique List with multiple conditions

  1. #1
    Registered User
    Join Date
    07-11-2017
    Location
    Edhome, where else?
    MS-Off Ver
    2016
    Posts
    48

    Get Unique List with multiple conditions

    Dear forummembers,

    I'm trying to retrieve certain values from a dataset (horizontally orientated like this).UnList Source.gif

    For each column in range O:V I need a list with data from unique customernumber (Custno).

    But only:

    - IF Artno is not empty
    - IF Custno is "123abc" a extra row needs to be added to the unique list which states Custno "456abc" (and Group and Artno with the data from custno "123abc")

    I've managed to get the list, only not the unique-part

    Here is my code and attached my testfile.

    I'm sure this is easypeasy for you but I just can't figure it out. So....help me please...

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

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Get Unique List with multiple conditions

    cell is declared as a Range object. if you want ws.Cells(x, "i") to equal the value, then use the Value property.
    Please Login or Register  to view this content.
    Good practice would say to use .Value on all of those cell references where you are trying to insert the cell values. The compiler can decipher some without much problem, but a declared varible sometimes causes it to hiccup.
    Last edited by JLGWhiz; 06-25-2018 at 05:28 PM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Get Unique List with multiple conditions

    Attach a sample workbook (not a picture or pasted copy). 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.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    07-11-2017
    Location
    Edhome, where else?
    MS-Off Ver
    2016
    Posts
    48

    Re: Get Unique List with multiple conditions

    @JLGWhiz, thanks I've adjusted the code.

    @xladept, thanks I adjusted the workbook and added a before and after sheet. Hope this helps to clarify my question.
    Attached Files Attached Files

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Get Unique List with multiple conditions

    I just added a string as a bypass switch to your code:

    Please Login or Register  to view this content.
    Last edited by xladept; 06-25-2018 at 07:38 PM.

  6. #6
    Registered User
    Join Date
    07-11-2017
    Location
    Edhome, where else?
    MS-Off Ver
    2016
    Posts
    48

    Re: Get Unique List with multiple conditions

    Yes, of course.

    Using the Instr function ( [start], parent_string, substring, [compare] ) duplicates are prevented.

    Thank you XLADEPT, this bypass does exactly what I was looking for.

    Have a sunny day!

    Best regards,

    mamaexcel

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Get Unique List with multiple conditions

    You're welcome!

+ 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] Extract List from one sheet to another with Unique Value (2 conditions)
    By sunjam in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-28-2017, 11:04 PM
  2. [SOLVED] Unique list based on conditions.
    By pauldaddyadams in forum Excel General
    Replies: 3
    Last Post: 08-15-2016, 10:25 AM
  3. [SOLVED] Count unique cells with multiple conditions
    By Sladamuss in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-13-2016, 07:59 AM
  4. Count Unique Item #'s with multiple conditions
    By Junebug81 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-25-2016, 06:29 PM
  5. Generating a list of unique values based on specific conditions
    By Gobaith in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-05-2012, 11:35 AM
  6. Lookup Unique based on Multiple Conditions
    By statenja in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-05-2009, 09:31 AM
  7. Count unique logs with multiple conditions of multiple sheets
    By Robert Bob in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-12-2007, 12:49 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