Multiple columns lookup

Sipirili2504

New Member
Joined
Aug 18, 2024
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hi. I have the below macro. I need help to amend it to return the results of column J instead of 1 or 0.
Basically I need column AD to AH in sheet "Master" to lookup column D to H in sheet "Lookup" and if any of the 2 column matches, it need to return column J from sheet "Lookup" in column AH of sheet "Master".
There are a lot of empty cells in between so the match must exclude these cells and I will then need to copy those rows with matching values to another sheet Review.
Kindly note that there are more than 10000 rows of data. Any help will be appreciated.


Dim LastRow as Integer
Lastrow = Cells(Rows.Count, 1).End(xlUp).row

With Worksheets ("Master")

.Range("AH2:AH & LastRow).Formula2R1C1= _
"IF(OR(SUMPRODUCT(--(Master!RC[07]=Lookup!C[-31]),--(Master!RC[-6]=Lookup!c[-30])--(Master!RC[-5]=Lookup!c[-29])--(Master!RC[-4]=Lookup!c[-28])--(Master!RC[-3]=Lookup!c[-27]))),(Master!RC[06]=Lookup!C[-30]),--(Master!RC[-7]=Lookup!c[-31])--(Master!RC[-5]=Lookup!c[-29])--(Master!RC[-4]=Lookup!c[-28])--(Master!RC[-3]=Lookup!c[-27])))>0,1,0)"

End with
End Sub
 

Attachments

  • Lookup.jpg
    Lookup.jpg
    107.3 KB · Views: 12
  • Master.jpg
    Master.jpg
    73.7 KB · Views: 12

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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