Vlookup with IF

JadonR

Board Regular
Joined
Apr 15, 2009
Messages
154
Office Version
  1. 365
I would like to create a formula for cell Y2 that uses a vlookup to lookup the value in column 'A' from the 'Purchasing Units' sheet. If it is greater than 0, then show '1'. If it doesn't match, then show nothing ("").

So in other words:

=IF(Y4>0,1,"")

now I need to replace the 0 with =VLOOKUP(Y2,'Purchasing Units'!A:B,1,FALSE)

Sorry for the poor explanation. :eeek:
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I would like to create a formula for cell Y2 that uses a vlookup to lookup the value in column 'A' from the 'Purchasing Units' sheet. If it is greater than 0, then show '1'. If it doesn't match, then show nothing ("").

So in other words:

=IF(Y4>0,1,"")

now I need to replace the 0 with =VLOOKUP(Y2,'Purchasing Units'!A:B,1,FALSE)

Sorry for the poor explanation. :eeek:

Code:
=IF(VLOOKUP(Y2,'Purchasing Units'!A1:A100,1,FALSE)>0,1,"")

Just throwing that out there, not sure if it will work. Change the A1:A100 to your desired range of cells.
 
Upvote 0
Hi,

The 1 in the formula is correct or is a typo?

=VLOOKUP(Y2,'Purchasing Units'!A:B,1,FALSE)

This, if founded, returns the lookup-value Y2 .....(?)

M.

-Edit-

I hadnt seen the previous post. If this works...Ok
 
Last edited:
Upvote 0
Thanks for checking Marcelo, but column A is where I want to have the lookup take the values from. However, tc88's formula returns a #N/A error for any values that are not in the vlookup on the 'Purchasing Units' sheet. Can anybody modify his formula to result in an empty cell when there is no match.


I tried the following but to no avail:
Code:
=IF(ISNA(VLOOKUP(Y717,'Purchasing Units'!A$3:B$100,1,FALSE)>0,1),"",VLOOKUP(Y717,'Purchasing Units'!A$3:B$100,2,FALSE)>0,1)
 
Upvote 0
Hi,

Why not use COUNTIF?

=IF(COUNTIF('Purchasing Units'!A$3:A$100,Y2)>0,1,"")

HTH

M.
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,882
Members
452,948
Latest member
Dupuhini

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