View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default VLookup: Can formula use value loaded from a drop down list?

So you're looking up the employee number based on the name?

If the formula is returning #N/A that means it is not finding a match of the
name in the lookup table.

What type of drop down are you using? A data validation list or a combo box?
A data validation list populates the cell that contains the drop down list
with the selected value. A combo box doesn't actually reside in a cell and
the selection made also doesn't populate a cell with the selected value.

Formula used: =vLOOKUP("b2",Employee!a:b,2,FALSE)


If B2 is the cell with the drop down list then remove the quotes:

=VLOOKUP(B2,Employee!A:B,2,0)

That may be why you were getting the #N/A error.

I also removed the quotes around the B2...
but then I get the #REF! error...


Hmmm...

That's a tough one to try to figure out. Do you have any formulas in
Employee!A:B that are returning #REF! ?

=VLOOKUP(B2,Employee!A:B,2,0)

That formula is syntactically correct. #REF! means that a reference is
invalid but your formula is very simple and nothing sticks out as being an
invalid reference.

Could it be that my numbers in the employee
number column are text?


Nah, that's not the problem, but see my point above about #REF! errors in
the lookup table.


--
Biff
Microsoft Excel MVP


"Jenilyn" wrote in message
...
I created a Travel Expense form for my small company. I want values to be
filled in automatically once the person types in their Name on the first
worksheet. (Name is filled in via a drop down list in B2. All Reference
data
is on additional sheets, but for this example, "Employee Name" and
"Employee
#" is on the worksheet titled Employee.)

Formula used: =vLOOKUP("b2",Employee!a:b,2,FALSE)

"B2" is populated by the drop down and is the Employee Name. Employee
worksheet looks like this:

Employee Name Employee #
Joe Schmoe 001
Bob Smith 002

I have inserted this formula in B3, because that's where I want the
Employee
# to populate. However, after inserting the formula, it gives me the
dreaded
#n/a response. I've stepped through the formula and I see that it is
reading
the name from the drop down properly, so what am I forgetting to check? I
also removed the quotes around the B2...but then I get the #REF!
error...which is worse, I think.

Could it be that my numbers in the employee number column are text? (I
need
it to be because some have letters in their ID.) I did change it to see
if
it made a difference, but it did not. I am stumped.

Thank you for your time.
J.