Matching 2 cells value on product code

Excelnewbie001

Board Regular
Joined
Jan 25, 2017
Messages
79
Looking for some solution code in Vba to match and display if there is an exact match of 2 cells with column VW values -values in red..if there is a match the product code must be written in column Y....sorry I did not write an additional column for Y. Inexample Product Code 50 and 55 have matches....so there Y columns would have had 50 and 55.Only 1 row must be checked on product code the row have the products codes values.Each row must be checked for a match on the product codes value. I am sure this can be done with a formula or vba function ? I have over 200 product codes and this will help me tremendously. Help will be greatly appreciated to achieve above Thank you
[TABLE="class: cms_table_grid, align: center"]
<tbody>[TR]
[TD]A
[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]V
[/TD]
[TD]W
[/TD]
[TD]X Product Code
[/TD]
[/TR]
[TR]
[TD]38
[/TD]
[TD]40
[/TD]
[TD]10[/TD]
[TD]20[/TD]
[TD]25[/TD]
[TD]30[/TD]
[TD]35[/TD]
[TD]38
[/TD]
[TD]40[/TD]
[TD]50
[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]10[/TD]
[TD]15[/TD]
[TD]30[/TD]
[TD]30[/TD]
[TD]35[/TD]
[TD]40[/TD]
[TD]48
[/TD]
[TD]50
[/TD]
[TD]51
[/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]15[/TD]
[TD]20[/TD]
[TD]40[/TD]
[TD]35[/TD]
[TD]40[/TD]
[TD]50[/TD]
[TD]58[/TD]
[TD]55[/TD]
[TD]52[/TD]
[/TR]
[TR]
[TD]8
[/TD]
[TD]20[/TD]
[TD]30[/TD]
[TD]50[/TD]
[TD]40[/TD]
[TD]45[/TD]
[TD]55[/TD]
[TD]68[/TD]
[TD]60[/TD]
[TD]53[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]25[/TD]
[TD]35[/TD]
[TD]60[/TD]
[TD]45[/TD]
[TD]50[/TD]
[TD]60[/TD]
[TD]78[/TD]
[TD]70[/TD]
[TD]54[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]30[/TD]
[TD]88
[/TD]
[TD]75
[/TD]
[TD]50[/TD]
[TD]60[/TD]
[TD]70[/TD]
[TD]88[/TD]
[TD]75[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]14
[/TD]
[TD]35[/TD]
[TD]50[/TD]
[TD]80[/TD]
[TD]55[/TD]
[TD]70[/TD]
[TD]75[/TD]
[TD]98[/TD]
[TD]80[/TD]
[TD]56[/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]40[/TD]
[TD]55[/TD]
[TD]90[/TD]
[TD]60[/TD]
[TD]75[/TD]
[TD]80[/TD]
[TD]108[/TD]
[TD]85[/TD]
[TD]57[/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]45[/TD]
[TD]75[/TD]
[TD]100[/TD]
[TD]65[/TD]
[TD]80[/TD]
[TD]85[/TD]
[TD]118
[/TD]
[TD]90[/TD]
[TD]58[/TD]
[/TR]
</tbody>[/TABLE]
 
This version will only match should the searched for values be in adjacent cells in the correct order:

Code:
Dim arr()
With Sheets("Sheet1")
    lr = .Range("A" & Rows.Count).End(xlUp).Row
    ReDim arr(1 To lr)
    For i = 1 To lr
        myMatch = Application.Match(.Cells(i, 22), Range(.Cells(i, 1), .Cells(i, 7)), 0)
        If Not IsError(myMatch) Then
            If .Cells(i, myMatch + 1) = .Cells(i, 23) Then
                arr(i) = .Cells(i, 24).Value
            End If
        End If
    Next
    Range(.Cells(1, 25), .Cells(lr, 25)) = Application.Transpose(arr)
End With


This one works flawlessly........Wow thank you very much Steve!!!!! You have just saved me allot of time....Busy implementing it now. Great coding
 
Upvote 0

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