=VLOOKUP question

jgarner

Board Regular
Joined
Jul 24, 2006
Messages
126
I have a spreadsheet with two columns of data: A1 - School & B1 - Code. In cell A2 I use a validation list drop down menu which uses data from another sheet tab to select which school I want. In cell B2, I use VLOOKUP to auto-populate data. Here is the formula I use for B2: =VLOOKUP(A2,School:Code,2). The problem I have is that when I first open up the spreadsheet, and I haven't selected a school from the drop down menu in A2, cell B2 has #N/A in it. Is there a way around this so that cell B2 remains empty until I select a school for A2? Thanks in advance.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
A couple of ways to handle this. Here is one:

=IF(ISERROR(VLOOKUP(A2,School:Code,2)),"",VLOOKUP(A2,School:Code,2))
 
Upvote 0
Thanks for the replies.

One other issue I just came across, the =VLOOKUP returns the same value for 3 out of the 4 items I have in the column. No sure why? Its as if the VLOOKUP is not working / changing the value for some reason?
 
Upvote 0
You should use VLOOKUP with a 4th argument of zero or FALSE, i.e.

VLOOKUP(A2,School:Code,2,0)

If you don't have the zero then VLOOKUP expects school list to be sorted ascending, if that isn't the case you may get odd results. Zero also means you only get an exact match, which seems to be what you need
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

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