+ Reply to Thread
Results 1 to 16 of 16

Vlookup(?) based on group of values

  1. #1
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Vlookup(?) based on group of values

    Sample workbook.xlsx

    Hi,

    See sample workbook.

    I have a list of names in column A. In column B there's numbers.

    I want to list all names from column A that have the exact same numbers in column B.

    In the sample workbook, apple and oranges contains the exact same numbers, even if they are not in the same order.
    I want them listed below.

    If i.e value in B16 is 15, then there's not 100% match and oranges will not be listed.

    In my list theres hundreds of names, so having a formula with specific names in it will be a lot of work.

    My problem is a bit tricky to explain, so please ask if it is difficult to understand.


    Thanks.

    Windows 7
    Excel 2013

  2. #2
    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,363

    Re: Vlookup(?) based on group of values

    In your example, if B16=15, neither oranges nor apples would be shown as you want 100% match i.e. same count of number of apples and oranges with same corresponding values (?).

  3. #3
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Re: Vlookup(?) based on group of values

    Quote Originally Posted by JohnTopley View Post
    In your example, if B16=15, neither oranges nor apples would be shown as you want 100% match i.e. same count of number of apples and oranges with same corresponding values (?).
    That's correct. It has to be 100% match, else nothing will be shown.

    In my actual workbook though, I have car names in column A and parts in column B.
    I want to list all cars that have the exact same parts in column B.

    Then I can conclude that every car that will be listed is the exact same car, just with different names.

    I've added a new sample: sample2.xlsx

    Here BMW and Audi are 100% match and I want them listed.
    VW is also a match but include 1 more part. If possible, I want this listed as well with a different color or something to show that it is the same car, with 1 or more parts.

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Vlookup(?) based on group of values

    Don't quote whole posts -- it's just clutter. If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

  5. #5
    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,363

    Re: Vlookup(?) based on group of values

    I have put together a possible VBA solution which requires data be sorted by Make then Parts. At the moment it only deals with 100% matches

    Two lists are created using formulae in Columns C and D

    In C to get unique list of Makes

    =IFERROR(INDEX($A$2:$A$501,MATCH(0,INDEX(COUNTIF($C$1:C1,$A$2:$A$501),0,0),0)),"")

    in D to get count of Parts for each Make

    =IF($C2="","",COUNTIF($A$2:$A$501,$C2))

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

  6. #6
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Re: Vlookup(?) based on group of values

    Thanks,

    I get an error in this line in macro: m1 = WorksheetFunction.Match(Make(r, 1), Range("Make"), 0) - 1 '

  7. #7
    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,363

    Re: Vlookup(?) based on group of values

    My error: change named range "Models" to "Make": I obviously changed the code but not the named range

  8. #8
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Re: Vlookup(?) based on group of values

    It worked in some of them, but not all.

    Wish I could post my actual sheet, but it's kind of confidential.

    I have some blanks in column B where there is text in column A, and vice versa. Could that be an issue?

  9. #9
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Re: Vlookup(?) based on group of values

    Edit: Double post

  10. #10
    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,363

    Re: Vlookup(?) based on group of values

    Remember data needs to be sorted by "Make" (A) and then "Parts" (B): macro will not work otherwise.

  11. #11
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Re: Vlookup(?) based on group of values

    Yes, macro runs fine and everythings looks good, but when the parts doesn't match when I manually check it by filtering the matches.

  12. #12
    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,363

    Re: Vlookup(?) based on group of values

    Not sure what you mean by

    when the parts doesn't match when I manually check it by filtering the matches.
    is it related to this ???
    At the moment it only deals with 100% matches
    Post file illustrating problem.

  13. #13
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Re: Vlookup(?) based on group of values

    sample4.xlsm

    Attached a small sample to illustrate the problem. The actual list is huge.
    Last edited by goranimo; 02-03-2016 at 05:04 AM.

  14. #14
    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,363

    Re: Vlookup(?) based on group of values

    See attached: hopefully this gives you the results in your actual list.

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

  15. #15
    Forum Contributor
    Join Date
    04-11-2014
    Location
    Norway
    MS-Off Ver
    Office 365 version 2302
    Posts
    152

    Re: Vlookup(?) based on group of values

    Hi again,

    Thanks.

    I get an error here (Subscript out of range):

    Please Login or Register  to view this content.
    Do you know why?

  16. #16
    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,363

    Re: Vlookup(?) based on group of values

    Cannot diagnose without data. This is an issue when we are presented with a small sample of (usually simplified) data as we cannot "stress" test the code..

+ 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: 17
    Last Post: 06-22-2014, 02:32 PM
  2. Replies: 1
    Last Post: 02-10-2014, 10:26 PM
  3. sum up values in one column for every group based on other creteria
    By Alex_738 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-17-2013, 02:08 AM
  4. Group By the Records based on multiple Column Values
    By Kamalakar M in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-27-2013, 05:18 PM
  5. Group Rows Based on two values in a Column A
    By daillest319 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-19-2012, 03:51 PM
  6. Group Cells and Rank based on values
    By sharahoff in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-17-2012, 12:50 PM
  7. Finding top 2 values per group based on multiple criteria
    By schuc in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-22-2007, 10:51 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