Extracting data with multiple matching criteria

JCarr

New Member
Joined
Dec 24, 2014
Messages
3
Hello there,

I'm using Excel 2007, and I have been struggling to find the correct conditional formatting for my data. What I have are 4 columns. The first column contains a Job Number(all job numbers are unique), the other three columns contain lot numbers associated with a component of the Job (these may be unique or may have duplicates). What I need to do is to show which job numbers have each and every component of the job match with another job components.


For example,

Job Number Component1 Component2 Component3
Job#1 555 AB 8A
Job#2 899 CD 8F
Job#3 555 AB 8A
Job#4 899 CD 8F
Job#5 555 AB 8Q


To clarify, all components of Job #1 match with Job #3 and all components of Job #2 match with Job #4 and Job #5 doesn't have all components matching with another because of component3. What I would need to extract (i.e. show in another part of the spreadsheet which jobs match with eachother.) I want to be able to continuously add data to this and continuously extract matches.

I've tried using Match and Index formatting, but couldn't seem to get it right.

Suggestions?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Welcome to the MrExcel board!

1. You mentioned not getting Conditional Formatting right but also showing data in another part of the sheet. Conditional Formatting will not move the data. Please clarify.

2. If jobs match, will they only ever be in pairs like these samples? Or might Jobs #1, #5 and #6 all match?

3. Do you specifically need to show which Jobs match with which or just that jobs match somewhere?

Perhaps you could help clarify all of the above, not only with further description, but also posting what you want the results to actually look like.

4. If the easiest way to achieve what you want is by a macro, is that okay?
 
Upvote 0
These Jobs will not necessarily be in pairs, there may be many Jobs which have all components match. I need to specifically show which Jobs match with which and then display the Job Numbers that match. What I want it to show is:

Job Number Component1 Component2 Component3 Matching Jobs
Job#1 555 AB 8A Job #1 Job #3 Job#6
Job#2 899 CD 8F Job #2 Job#4
Job#3 555 AB 8A
Job#4 899 CD 8F
Job#5 555 AB 8Q
Job#6 555 AB 8A


Essentially, showing that Job 1,3,6 match with each other and Job 2,4 match with eachother. I need this to be automatic, such that as I continuously add Job information it will update which Jobs match. If using a Macro is easiest, it will be okay!
 
Upvote 0
Job NumberComponent 1Component 2Component 3Matching Jobs""""
Job #1555AB8AJob #1Job#Job #6
Job #2899CD8FJob #2 Job #4
Job #3555AB8A
Job #4899CD8F
Job #5555AB8Q
Job #6555AB8A

<tbody>
</tbody>

I hope using this table makes it slightly easier to see. Again, I need it to continuously show me which Job numbers match with which as I add more Jobs. I
 
Upvote 0
Assuming data is in columns A:D & results to go into column E, try this in a copy of your workbook.

1. Right click the sheet name tab and choose "View Code".

2. Copy and Paste the code below into the main right hand pane that opens at step 1.

3. Close the Visual Basic window & test.

4. If using Excel 2007 or later your workbook will need to be saved as a macro-enabled workbook (*.xlsm)



Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim d As Object
  Dim a, b, Itm
  Dim i As Long
  Dim s As String
  
  Set d = CreateObject("Scripting.Dictionary")
  d.CompareMode = 1
  a = Range("A2", Range("D" & Rows.Count).End(xlUp)).Value
  ReDim b(1 To UBound(a, 1), 1 To 1)
  For i = 1 To UBound(a, 1)
    s = a(i, 2) & "|" & a(i, 3) & "|" & a(i, 4)
    If d.Exists(s) Then
      d.Item(s) = d.Item(s) & ", " & a(i, 1)
    Else
      d.Add s, i & "%" & a(i, 1)
    End If
  Next i
  For Each Itm In d.items
    If InStr(1, Itm, ",") Then
      b(Split(Itm, "%")(0), 1) = Split(Itm, "%")(1)
    End If
  Next Itm
  Application.EnableEvents = False
  Range("E2").Resize(UBound(b, 1)).Value = b
  Columns("E").AutoFit
  Application.EnableEvents = True
End Sub


Results as data entered/edited/removed in columns A:D

Excel Workbook
ABCDE
1Job NumberComponent1Component2Component3Matching Jobs
2Job#1555AB8AJob#1, Job#3, Job#6, Job#11
3Job#2899CD8FJob#2, Job#4
4Job#3555AB8A
5Job#4899CD8F
6Job#5555AB8Q
7Job#6555AB8A
8Job#71
9Job#8555AB8AJob#8, Job#16
10Job#93
11Job#104
12Job#11555AB8A
13Job#126
14Job#137
15Job#148
16Job#159
17Job#16555AB8A
18Job#1711
19Job#1815
20Job#1913
21Job#2044ggg22xJob#20, Job#21
22Job#2144ggg22x
Matching Jobs
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,728
Messages
6,132,360
Members
449,720
Latest member
NJOO7

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top