Lookup from multiple columns

rollingzep

Board Regular
Joined
Nov 18, 2013
Messages
214
Office Version
  1. 365
Platform
  1. Windows
Hi,

For my sheet, I need to lookup values from two different columns.

Using one column, I get values.

ws.Range("AU2:AU" & ws.Cells(Rows.Count, "Y").End(xlUp).Row).FormulaR1C1 = "=VLOOKUP(""*""&RC[-22]&""*"",HQLA!C1:C35,35,0)"

Also, I need to read it from the Column, C3 of HQLA.

How to use the below along with the above

ws.Range("AU2:AU" & ws.Cells(Rows.Count, "Y").End(xlUp).Row).FormulaR1C1 = "=VLOOKUP(""*""&RC[-22]&""*"",HQLA!C3:C35,35,0)"


Using C1, I get values like IG-1, N-2.

1660928398851.png


For missing values, "#N/A",I need it to read from Col, C3.
 
I agree but I am using my code for other features in addition to this Vlookup.
That is why I need it in VBA since it has more than 1500 to 2000 rows
LEN is an EXCEL function so you can use it in cell of a worksheet. So there is no need to use VBA. I was suggesting using it to combine the two lookup into one cell.
To do the entire column just copy it down.
I tried
ws.Range("AU2:AU" & ws.Cells(Rows.Count, "Y").End(xlUp).Row).Formula = _
"=IF(Len(Y2>9),(VLOOKUP(HQLA!C3:C33,33,0)),VLOOKUP(HQLA!C1:C35,35,0))"

But I am getting a #VALUE error
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
I sugest you try each lookup equation on their own in two separate columns or do it twice in succession which each lookup equaiton
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,187
Members
449,090
Latest member
bes000

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