# =VLOOKUP question

#### jgarner

##### Board Regular
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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

#### barry houdini

##### MrExcel MVP
Try using a formula like

=IF(A2="","",VLOOKUP(....))

#### hkaplan2

##### Active Member
A couple of ways to handle this. Here is one:

=IF(ISERROR(VLOOKUP(A2,School:Code,2)),"",VLOOKUP(A2,School:Code,2))

#### jgarner

##### Board Regular
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?

#### barry houdini

##### MrExcel MVP
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

#### jgarner

##### Board Regular
That did the trick! Thanks again.

Replies
0
Views
566
Replies
0
Views
174
Replies
0
Views
259
Replies
2
Views
106
Replies
3
Views
97

1,191,040
Messages
5,984,289
Members
439,882
Latest member
gerdc

### 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.

### Which adblocker are you using?

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

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