Vlookup with conditions

Deelof

New Member
Joined
Aug 30, 2023
Messages
34
Office Version
  1. 2019
Platform
  1. Windows
Column B "Last PO Placed" uses a vlookup - =IF(ISNA(VLOOKUP($A20845,'PO''s Placed'!$R:$S,2,FALSE)),"",VLOOKUP($A20845,'PO''s Placed'!$R:$S,2,FALSE))
For any blanks returned from the Vlookup, how can I build into this formula that if column A "Stock Status" holds Core or Core Non-Stock then it will return "Not Yet Purchased"and all other blanks will return another value, for example "3Yr+"?

STOCK STATUSLAST PO PLACED
CORE
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
For any blanks returned from the Vlookup

if there is a blank for the vlookup - usually that would return a zero and NOT a blank
can you show examples

here is my example - where a blank returns a zero
Book5
ABCDEFG
1
2301a
32b
43
54d
Sheet1
Cell Formulas
RangeFormula
B2B2=VLOOKUP(A2,F1:G5,2,FALSE)


Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
 
Upvote 0
if there is a blank for the vlookup - usually that would return a zero and NOT a blank
can you show examples

here is my example - where a blank returns a zero
Book5
ABCDEFG
1
2301a
32b
43
54d
Sheet1
Cell Formulas
RangeFormula
B2B2=VLOOKUP(A2,F1:G5,2,FALSE)


Therefore -

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

This will possibly enable a quicker and more accurate solution for you.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC

then put the sample spreadsheet onto a share

I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
Please make sure you have a representative data sample and also that the data has been desensitised, remember this site is open to anyone with internet access to see - so any sensitive / personal data should be removed

Make sure you set any share or google to share to everyone
It is returning blank due to this section of the vlookup formula (bold underlined.

=IF(ISNA(VLOOKUP($A20845,'PO''s Placed'!$R:$S,2,FALSE)),"",VLOOKUP($A20845,'PO''s Placed'!$R:$S,2,FALSE))
 
Upvote 0
ok,
so thats because the vlookup is returning an error in the IF
how can I build into this formula that if column A "Stock Status" holds Core or Core Non-Stock then it will return "Not Yet Purchased"and all other blanks will return another value, for example "3Yr+"?

=IF(ISNA(VLOOKUP($A20845,'PO''s Placed'!$R:$S,2,FALSE)), If( OR( $A20845 ="Core" , $A20845 ="core non-stock"), "not yet purchased", "3Yr+" ) ,VLOOKUP($A20845,'PO''s Placed'!$R:$S,2,FALSE))

so that may work - also maybe able to simplify nothing else starts with CORE

if that does not work - then really need a sample sheet with allpossible combinations and expected results
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,218
Members
449,091
Latest member
jeremy_bp001

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