Returning a value via Vlookup but only When a condition in another field is met

Genes22

New Member
Joined
Jun 19, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Is there any way to run vlookup but to limit the formula based on the condition in another field.
My vlookup is the standard formula,

=VLOOKUP(B2,'LocateIT Imported JB Stock File'!C:E,3,FALSE)

The below image is of LocteIT imported JB stock file.

but I only want to return the vlookup value if the status = 100 ie not if the status is 202.
Can this be done in Excel?

Normally, I would convert the below table to a pivot, filter on only status 100 and then refer to this pivot table to get the vlookup value.

I assume there must be a better way to do this.
Using Office 365 in Windows environment.

TIA
 

Attachments

  • Mr Excel.png
    Mr Excel.png
    28 KB · Views: 11

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You can use filter on the lookup table:

Excel Formula:
=VLOOKUP(B2,FILTER('LocateIT Imported JB Stock File'!C:E,'LocateIT Imported JB Stock File'!D:D=100),3,FALSE)

or skip the lookup altogether:

Excel Formula:
=FILTER('LocateIT Imported JB Stock File'!E:E,('LocateIT Imported JB Stock File'!D:D=100)*('LocateIT Imported JB Stock File'!C:C=B2))
 
Upvote 0
Solution
You can use filter on the lookup table:

Excel Formula:
=VLOOKUP(B2,FILTER('LocateIT Imported JB Stock File'!C:E,'LocateIT Imported JB Stock File'!D:D=100),3,FALSE)

or skip the lookup altogether:

Excel Formula:
=FILTER('LocateIT Imported JB Stock File'!E:E,('LocateIT Imported JB Stock File'!D:D=100)*('LocateIT Imported JB Stock File'!C:C=B2))
Thanks Rory, that worked a treat!
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,976
Members
449,095
Latest member
Mr Hughes

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