+ Reply to Thread
Results 1 to 18 of 18

Find unique value in one column, then any corresponding values in adjacent column

  1. #1
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9

    Find unique value in one column, then any corresponding values in adjacent column

    Hello!

    I have two columns of data and I'm trying to find all the uniques in (A) the first column, then match for uniques in (B) the adjacent column and return as shown below in C and D. I've tried several Index/Match/Countif options but can't seem to get the layout right or get all uniques. Appreciate your help!

    Table Sample.png

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

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Including a sample sheet and jpg for best compatibility.Test Sheet.xlsxTable Sample.jpg

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Find unique value in one column, then any corresponding values in adjacent column

    In c2, copied down:
    =IFERROR(INDEX($A$2:$A$15,MATCH(D2,$B$2:$B$15,0)),"")

    In D2, copied down:
    =IFERROR(INDEX($B$2:$B$15,MATCH(0,INDEX(COUNTIF($D$1:$D1,$B$2:$B$15),0),0)),"")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  5. #5
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Hi, Glenn. Thanks for the help! I found one issue that I might have that I didn't consider before. Once a unique is found in B that matches A, it won't return that same value if also a match for a second value in A. Please see attached. When I put penne as a fruit, it doesn't return the Pasta/penne combination. So, essentially, column B could have values that match one or many unique values in A. Any idea how to correct this?Test Sheetv2.xlsx

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Hey K-Dog,

    Your question is exactly what the advanced*filter does when you check the "Unique" box.

    Click on the data tab and then on Advanced Filter. Select your columns A:B and leave the criteria blank. Click where you want the*answer to go and check the unique box. Boom! Done!

    http://www.contextures.com/xladvfilter01.html
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Or, should you prefer a dynamic, formula-based solution: here are two options for you....
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Glenn,

    These are great options to have! Thanks! Though Marvin's suggestion of the Advanced Filter is a great hack, I am definitely hoping to get something formula based to reduce a step, but can't figure out how to return uniques from B that may apply to multiple values in A as I mentioned above. Once it finds a unique in B, it won't return that unique if it applies to another value in A. (i.e. When I put penne as a fruit, it doesn't return the Pasta/penne combination.) but I'd like the returned values in the same format as my first example. Does that make sense?

  9. #9
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Thanks, MarvinP. That's a great hack to have!

  10. #10
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Did you actually look at Option 1 in Post 7??? What are E7 to F8 showing?

  11. #11
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9
    Quote Originally Posted by Glenn Kennedy View Post
    Did you actually look at Option 1 in Post 7??? What are E7 to F8 showing?
    I did see that and want that exact output but liked that your initial formula did not add another column. Is it not possible without the concatenation? Thanks!

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Possibly... But why not just hide the helper column? Or put it on another sheet & hide the whole sheet?

  13. #13
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,910

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Another way ...

    =IFERROR(INDEX(A$2:A$15,MATCH(0,COUNTIFS($C$1:$C1,$A$2:$A$15,$D$1:$D1,$B$2:$B$15),0)),"")

    Copy across and down.
    Attached Files Attached Files

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Very nice Phuocam!!

  15. #15
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Hey K-Dog,

    Calling*the Advanced Filter Method a "hack" is not quite correct. Excel has lots of tools built into it. Filters, Sorts, Formulas, Named Ranges are all great tools. NOT HACKS!!

    I can do your problem with 7 mouse clicks and no formulas are needed. I'd call that a great tool, if you know how to use it. Learn a bit more about Advanced Filters and you will see how easy your problem is. If you need to automate it with different sizes of datasets you can create a Macro in VBA to do those 7 clicks. OH - VBA and Macros are*other great tools built into Excel. They aren't hacks either.

  16. #16
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Phuocam,

    This is perfect! How can I make it search all of column A and B instead of a range?

  17. #17
    Registered User
    Join Date
    01-31-2017
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    9

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Noted, thanks, MarvinP.

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,202

    Re: Find unique value in one column, then any corresponding values in adjacent column

    Create dynamic named ranges: Group and Item

    For Group

    Name: Group

    Refers to: =OFFSET(Sheet1!$A$2,0,0,COUNTIF(Sheet1!$A:$A,"?*")-1)

    For Item

    Name: Item

    Refers to: =OFFSET(Sheet1!$B$2,0,0,COUNTIF(Sheet1!$B:$B,"?*")-1)

    Formulae:

    in C2

    =IFERROR(INDEX(Group,MATCH(0,COUNTIFS($C$1:$C1,Group,$D$1:$D1,Item),0)),"")

    in D2

    and

    =IFERROR(INDEX(Item,MATCH(0,COUNTIFS($C$1:$C1,Group,$D$1:$D1,Item),0)),"")

+ 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] need formula to get unique values through lookup from adjacent column extent range
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-08-2016, 02:59 AM
  2. [SOLVED] Look for duplicated & unique values in adjacent column. Perform math on result. . .
    By PeteABC123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-25-2013, 12:04 PM
  3. [SOLVED] Count Unique Values in a Column that are not in adjacent Column
    By sskgintl in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-15-2013, 03:18 PM
  4. Macro to find all specific values in column and replace adjacent cell values
    By dblock02 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-23-2013, 06:03 AM
  5. Replies: 0
    Last Post: 09-06-2012, 04:06 AM
  6. Pull unique values based on adjacent column
    By freud1 in forum Excel General
    Replies: 9
    Last Post: 07-02-2012, 11:36 AM
  7. Replies: 3
    Last Post: 03-17-2012, 11:32 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