LOOKUP instead of IF

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a formula that searches for text in a column and
returns a matching number based on the text that is entered in that cell.

A portion of the formula that I created is below where my real list is 19
rows long, which is why I can't use the IF formula.

=LOOKUP(D13,{EUE,NUE,STC,LTC},{"0150","0151","0152","0153"})

When I enter this formula and check the function, the LOOKUP_Vector reads
"Invalid".

I have used the same formula with success in the same workbook, but the
look-up vector is numbers instead of text.

Any suggestions?
 
put quote marks around the text
=LOOKUP(D13,{"EUE","NUE","STC","LTC"},{"0150","0151","0152","0153"})
will work
 
=LOOKUP(D13,{EUE,NUE,STC,LTC},{"0150","0151","0152","0153"})

The lookup_vector must be sorted ascending and you're missing " ":

=LOOKUP(D13,{"EUE","LTC","NUE","STC"},{"0150","0151","0152","0153"})

If you have 19 pairs of data you'd be better off making a lookup table on
your sheet and referring to that table rather than hardcoding all that into
a formula.

Biff
 
Thanks for this. What would the code look like for referring to a table
rather than hardcoding my 19 pieces of data?
 
if your text were in C20 through C40
and the associated numbers in D20 through D40
try
=vlookup(D13,C20:D40,2)
 
Thanks Sooooo Much! This helped me a ton!


bj said:
if your text were in C20 through C40
and the associated numbers in D20 through D40
try
=vlookup(D13,C20:D40,2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top