Find Duplicate Rows, Match a value in a column, then return a third column value

dxsley

New Member
Joined
Dec 8, 2017
Messages
2
Ok... So I have seven columns... I want to find the duplicate rows (c column) and then find the rows that don't have a value of QC in column F, then return the number in column G of the duplicate rows that don't have a value of QC in column F but are duplicate values in column C.

ANY HELP IS APPRECIATED

A B C D D F G
25-Nov-1711:02:4717-3290056EMS Response140MM137
25-Nov-1711:02:4717-3290056EMS Response140OC137
25-Nov-1710:09:2917-3290049EMS Response140QC182
25-Nov-1710:09:2917-3290049EMS Response140MM204
25-Nov-1710:09:2917-3290049EMS Response140OC204
25-Nov-1706:22:5617-3290029EMS Response140MM157
25-Nov-1706:22:5617-3290029EMS Response140OC157
25-Nov-1706:22:5617-3290029EMS Response140QC178
25-Nov-1701:41:4617-3290010EMS Response140QC153
25-Nov-1701:41:4617-3290010EMS Response140MM164
25-Nov-1701:41:4617-3290010EMS Response140OC164
24-Nov-1723:21:5217-3280185EMS Response140QC153
24-Nov-1723:21:5217-3280185EMS Response140MM164
24-Nov-1723:21:5217-3280185EMS Response140OC164

<colgroup><col span="2"><col><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Let me update what I'm looking for, I don't think I explained it correctly. Basically, I'm looking to return the value of column G with the MM value in column F within the duplicate rows based on the value (duplicate) in column C. However, I only was to return the G value when any one of the duplicate rows do not contain a QC value in column F. So, in short. I'm looking for duplicate rows where in column F there is only either a MM or OC and then return the value in column G of the duplicate row containing the value MM in column F. I'm believing this is nearly impossible in excel and would need coding. If anyone can figure this out, I'll bow to your expertise. Thanks in adavance.
 
Upvote 0
Perhaps this:-
Actual data assumed to start "A2".
Code:
[COLOR="Navy"]Sub[/COLOR] MG09Dec18
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] Rw, Q [COLOR="Navy"]As[/COLOR] Variant
[COLOR="Navy"]Set[/COLOR] Rng = Range("C2", Range("C" & Rows.Count).End(xlUp))
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Not Dn.Offset(, 3).Value = "QC" [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]If[/COLOR] Not .Exists(Dn.Value) [COLOR="Navy"]Then[/COLOR]
            [COLOR="Navy"]If[/COLOR] Dn.Offset(, 3) = "MM" [COLOR="Navy"]Then[/COLOR] Rw = Dn.Row
            .Add Dn.Value, Array(Dn, Rw)
        [COLOR="Navy"]Else[/COLOR]
           Q = .Item(Dn.Value)
            [COLOR="Navy"]If[/COLOR] Dn.Offset(, 3) = "MM" [COLOR="Navy"]Then[/COLOR] Q(1) = Dn.Row
            [COLOR="Navy"]Set[/COLOR] Q(0) = Union(Q(0), Dn)
            [COLOR="Navy"]If[/COLOR] Q(1) > 0 [COLOR="Navy"]Then[/COLOR] Q(0).Offset(, 4).Value = Q(1)
            .Item(Dn.Value) = Q
        [COLOR="Navy"]End[/COLOR] If
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR]
[COLOR="Navy"]End[/COLOR] With
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,795
Messages
6,121,624
Members
449,041
Latest member
Postman24

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