+ Reply to Thread
Results 1 to 23 of 23

Create a unique list of items from two tables

  1. #1
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Create a unique list of items from two tables

    Ello Excel Gurus
    I'm back, since I Know you guys I lerarned many thinks, but now I'm stuck with unique list
    I Know How to creat a unique list of items from one list,bt now I've two list
    I prefer the solution with the FREQUENCY Function
    Thank You do much


    A
    B
    C
    D
    1
    List1 List2 Result
    2
    Anna Nik Anna
    3
    Mark Mike Mark
    4
    Luis Anna Luis
    5
    Joe Luis Joe
    6
    Lucy Nik
    7
    Mike
    8
    Lucy



    Ervin

  2. #2
    Valued Forum Contributor
    Join Date
    10-14-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2019
    Posts
    353

    Re: Create a unique list of items from two tables

    Please have a look at this.....
    Attached Files Attached Files
    Kind regards,
    Piet Bom

  3. #3
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    PietBom thank you for the answer
    This was just a small sample, I have 100 of rows and as you said doesnt work, i know is possible with FREQUENCY function but i stuck
    Thank you

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Create a unique list of items from two tables

    Quote Originally Posted by XLalbania View Post
    i know is possible with FREQUENCY function but i stuck
    The FREQUENCY method won't work on a 2d range. Specifically, you have to use the MATCH function within the FREQUENCY function and the MATCH function won't accept 2d ranges as the lookup array argument.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Create a unique list of items from two tables

    Quote Originally Posted by PietBom View Post
    Please have a look at this.....
    Although there is no official rule regarding this behavior, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

  6. #6
    Valued Forum Contributor
    Join Date
    10-14-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2019
    Posts
    353

    Re: Create a unique list of items from two tables

    @Tony,
    Sorry for my behavior.
    I was not aware of that.
    I will give more substantial detail in the future.

    @XLalbania,
    I do have a formula for listing unique items from a single data list, but not for 2 data lists.
    Sorry for this.
    Maybe another guru can help you.

  7. #7
    Valued Forum Contributor
    Join Date
    10-14-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2019
    Posts
    353

    Re: Create a unique list of items from two tables

    @Tony,
    Sorry for my behavior.
    I was not aware of that.
    I will give more substantial detail in the future.

    @XLalbania,
    I do have a formula for listing unique items from a single data list, but not for 2 data lists.
    Sorry for this.
    Maybe another guru can help you.

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Create a unique list of items from two tables

    This should work for stacked columns (column A first with Column B under it)
    Enter in C2 and fill down until blanks appear.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This will work for "shuffled" columns (alternating Column A value then Column B value)
    Enter in C2 and fill down as above
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This is the result using your example
    Data Range
    A
    B
    C
    D
    1
    List1
    List2
    Result
    2
    Anna
    Nik
    Anna
    3
    Mark
    Mike
    Mark
    4
    Luis
    Anna
    Luis
    5
    Joe
    Luis
    Joe
    6
    Lucy
    Nik
    7
    Mike
    8
    Anna
    9
    Luis
    10
    Lucy
    11
    Attached Files Attached Files
    Last edited by newdoverman; 01-15-2017 at 02:27 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    Thank you everybody for your answer
    Probably I didn't expalint me very well
    I need a Unique list with data coming from two different tables (list1 and list2
    in this table you can see the answer from Newdovermann but the right answer is in th elast column

    Thank you fro your help


    A
    B
    C
    D
    E
    F
    1
    List 1 List 2 Newdovermann Newdovermann expected result
    2
    Anna Nik Anna Anna Anna
    3
    Mark Mike Mark Nik Mark
    4
    Luis Anna Luis Mark Luis
    5
    Joe Luis Joe Mike Joe
    6
    Lucy Nik Luis Nik
    7
    Mike Anna Mike
    8
    Anna Joe Lucy
    9
    Luis Luis
    10
    Lucy
    0
    11
    Lucy
    12
    0


    So we keep open thi threads because i'd like a olution
    Very kind

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Create a unique list of items from two tables

    If you inserted another new column D, so that the results are shown in column E, then you could use this formula in C2:

    =IF(COUNTIF(A$2:A2,A2)=1,MAX(C$1:C1)+1,"-")

    and this one in D2:

    =IF(AND(COUNTIF(B$2:B2,B2)=1,COUNTIF(A:A,B2)=0),MAX(D$1:D1)+1,"-")

    with this one in D1:

    =MAX(C:C)

    You can copy the formulae in C2:D2 down as far as you like to accommodate new data being added, and these set up a unique sequential number for each name in columns A and B that is unique.

    Then you can use this formula in E2:

    =IF(ROWS($1:1)>MAX(D:D),"",IF(ROWS($1:1)<=MAX(C:C),INDEX(A:A,MATCH(ROWS($1:1),C:C,0)),INDEX(B:B,MATCH(ROWS($1:1),D:D,0))))

    and copy this down. The approach is shown in the attached file.

    Hope this helps.

    Pete
    Attached Files Attached Files

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Create a unique list of items from two tables

    I forgot the "Unique" bit.
    In your vacant column C enter in C2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In D2 enter this and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Result:
    Data Range
    A
    B
    C
    D
    1
    List 1
    List 2
    Stacked Columns
    Unique Values
    2
    Anna
    Nik
    Anna
    Anna
    3
    Mark
    Mike
    Mark
    Mark
    4
    Luis
    Anna
    Luis
    Luis
    5
    Joe
    Luis
    Joe
    Joe
    6
    Lucy
    Nik
    Nik
    7
    Mike
    Mike
    8
    Anna
    Lucy
    9
    Luis
    10
    Lucy
    11

    The values in column C can be hidden by formatting the text as WHITE.
    Last edited by newdoverman; 01-15-2017 at 02:47 PM.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Create a unique list of items from two tables

    Try this...

    Data Range
    A
    B
    C
    D
    E
    1
    List1
    List2
    Count
    Result
    2
    Anna
    Nik
    7
    Anna
    3
    Mark
    Mike
    Nik
    4
    Luis
    Anna
    Mark
    5
    Joe
    Luis
    Mike
    6
    Lucy
    Luis
    7
    Joe
    8
    Lucy
    9
    10
    11
    ------
    ------
    ------
    ------
    ------


    This array formula** entered in D2:

    =SUM(IF(A2:B10<>"",1/COUNTIF(A2:B10,A2:B10)))

    This array formula** entered in E2:

    =IF(ROWS(E$2:E2)>D$2,"",INDEX(A$2:B$10,MIN(IF(A$2:B$10<>"",IF(ISNA(MATCH(A$2:B$10,E$1:E1,0)),ROW(A$2:B$10)-ROW(A$2)+1))),MOD(MIN(IF(A$2:B$10<>"",IF(ISNA(MATCH(A$2:B$10,E$1:E1,0)),(ROW(A$2:B$10)-ROW(A$2)+1)*100000+(COLUMN(A$2:B$10)-COLUMN(A$2)+1)))),100000)))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.

    I have a shorter formula that will do this but it uses volatile functions and will probably be slow to calculate on large amounts of data.

  13. #13
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    Wooow You rocks newdoverman
    Last question, since I'm studing the FREQUENCY function approcc formula, I know How to do it with one list but with to list is impossible

    I think I have to bild a vertical array like (this in red) an than everythig else is easy

    =INDEX{"Anna"."Mark"."Luis"."Joe"."Nik"."Mike"."Anna"."Luis"."Lucy"};SMALL(IF(FREQUENCY(MATCH..............
    I relly appreaciate your help
    Last edited by XLalbania; 01-15-2017 at 03:20 PM.

  14. #14
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    Excellt Tony
    Your formula works very well, but pease read post#13
    Thank
    you

  15. #15
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    Excellt Tony
    Your formula works very well, but please read post#13
    Thank
    you

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Create a unique list of items from two tables

    Here's how to use the FREQUENCY function on a single list...

    Data Range
    A
    B
    C
    1
    List1
    Uniques
    2
    Connie
    Connie
    3
    Connie
    Burt
    4
    Burt
    Creep
    5
    Creep
    Glib
    6
    Creep
    Kronk
    7
    Creep
    8
    Glib
    9
    Glib
    10
    Kronk
    11
    ------
    ------
    ------


    This array formula** entered in C2:

    =IFERROR(INDEX(A:A,SMALL(IF(FREQUENCY(MATCH(A$2:A$10,A$2:A$10,0),ROW(A$2:A$10)-ROW(A$2)+1),ROW(A$2:A$10)),ROWS($C$1:C1))),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.

    The reason the FREQUENCY function won't work on a 2d range is the highlighted section in the MATCH function won't accept 2d ranges.

  17. #17
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Create a unique list of items from two tables

    Did you check out my approach in Post #10 ?

    Pete

  18. #18
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Create a unique list of items from two tables

    This array formula (Enter with Ctrl + Shift + Enter) does not require helper columns.
    Array enter in D2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    Quote Originally Posted by Pete_UK View Post
    If you inserted another new column D, so that the results are shown in column E, then you could use this formula in C2:

    =IF(COUNTIF(A$2:A2,A2)=1,MAX(C$1:C1)+1,"-")

    and this one in D2:

    =IF(AND(COUNTIF(B$2:B2,B2)=1,COUNTIF(A:A,B2)=0),MAX(D$1:D1)+1,"-")

    with this one in D1:

    =MAX(C:C)

    You can copy the formulae in C2:D2 down as far as you like to accommodate new data being added, and these set up a unique sequential number for each name in columns A and B that is unique.

    Then you can use this formula in E2:

    =IF(ROWS($1:1)>MAX(D:D),"",IF(ROWS($1:1)<=MAX(C:C),INDEX(A:A,MATCH(ROWS($1:1),C:C,0)),INDEX(B:B,MATCH(ROWS($1:1),D:D,0))))

    and copy this down. The approach is shown in the attached file.

    Hope this helps.

    Pete
    Thank You Pete
    I didn't see you work
    That works fine but still is not what a needet
    see post#13 my request
    Thank you any way

  20. #20
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    Quote Originally Posted by newdoverman View Post
    This array formula (Enter with Ctrl + Shift + Enter) does not require helper columns.
    Array enter in D2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Yess!!
    This work perfectly
    even if not with FREQUENCY function
    I will stay with this approch
    Thank you every body for your help

    Bye
    Ervin

  21. #21
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Create a unique list of items from two tables

    Here's another one that works on 2 lists.

    Data Range
    A
    B
    C
    D
    1
    List1
    List2
    Uniques
    2
    Anna
    Nik
    Anna
    3
    Mark
    Mike
    Mark
    4
    Luis
    Anna
    Luis
    5
    Joe
    Luis
    Joe
    6
    Lucy
    Nik
    7
    Mike
    8
    Lucy
    9
    ------
    ------
    ------
    ------
    10


    This array formula** entered in D2:

    =IFERROR(INDEX(A$2:A$10,MATCH(1,(A$2:A$10<>"")+COUNTIF(D$1:D1,A$2:A$10),0)),IFERROR(INDEX(B$2:B$10,MATCH(1,(B$2:B$10<>"")+COUNTIF(D$1:D1,B$2:B$10),0)),""))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

  22. #22
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Albania
    MS-Off Ver
    2013
    Posts
    215

    Re: Create a unique list of items from two tables

    Thank you Tony
    Good formula too!

  23. #23
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Create a unique list of items from two tables

    You're welcome. Thanks for the feedback!

+ 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: 7
    Last Post: 11-21-2016, 04:40 PM
  2. [SOLVED] Create unique items in valiadtion list
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-10-2015, 05:41 PM
  3. [SOLVED] formula to create list of unique items
    By pink in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-13-2014, 02:29 AM
  4. [SOLVED] Limitation on formula to create list of unique items
    By cman0 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-23-2014, 11:44 AM
  5. [SOLVED] Counting # of Unique Items In List & Listing Unique Items In A List
    By unpluggedmusic in forum Excel General
    Replies: 3
    Last Post: 12-05-2012, 11:44 AM
  6. [SOLVED] create an array with unique items IN MEMORY
    By Werner Rohrmoser in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-25-2005, 10:05 AM
  7. Replies: 2
    Last Post: 07-15-2005, 02:05 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