How to apply vlookup with 2 different condition and files

Salamullah

Board Regular
Joined
Mar 28, 2011
Messages
221
I want to bring cost of the product based on local and imported files please help me to apply vlookup.


Summary
Code No. Cost.
A 40
B 50
C 60
D 70

Local
Code No. Cost
A 40
B 50

Imported Cost
C 60
D 70
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
dont fully understand your setup
is it because C does not exist in the Local table , you would then look at the Imported cost and find C
what happens if both A or B is also in the Imported Cost table
What happens if they do not exist in either table
Are these tables on separate sheets on the same workbook


you could use a lookup with an IF ()

Lookup value in Local - if error lookup value in Imported

=index(local!B:B,match(A2,local!A:A,0)
this will lookup the value from the local sheet table
IFERROR
lookup in Imported sheet
=index(imported!B:B,match(A2,imported!A:A,0)
so you could use a nested IF to include situation where neither exist OR a simple IFERROR

=IFERROR (index(local!B:B,match(A2,local!A:A,0), index(imported!B:B,match(A2,imported!A:A,0) )
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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