#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Lookup function

I would like to set up a lookup table. when I enter a value in the
spreadsheet, it will find the match value on the column A and print out the
value of column B.

See below
A B
A-01 10.5
A-02 5.6
A-2C 21.2
A-13 11.6

I used lookup function. If the entry is A-2C, the result shows 11.6 instead
of 21.2. Anyone can tell me why? How can I fix the problem? Besides, I
would like to set a function. If my entry does not exist in the table, e.g.
A-1B, I would like to show a "NA" in the result column so I know the input is
incorrect. Can you tell me how to do it?
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 207
Default Lookup function

=IF(ISNA(VLOOKUP(F1,Sheet1!A1:B4,2,FALSE)),"NA",VL OOKUP(F1,Sheet1!A1:B4,2,FALSE))

change the references to suit your need.


"sfeng63" wrote in message
...
I would like to set up a lookup table. when I enter a value in the
spreadsheet, it will find the match value on the column A and print out
the
value of column B.

See below
A B
A-01 10.5
A-02 5.6
A-2C 21.2
A-13 11.6

I used lookup function. If the entry is A-2C, the result shows 11.6
instead
of 21.2. Anyone can tell me why? How can I fix the problem? Besides, I
would like to set a function. If my entry does not exist in the table,
e.g.
A-1B, I would like to show a "NA" in the result column so I know the input
is
incorrect. Can you tell me how to do it?
Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 470
Default Lookup function

First of all, I cannot tell you what is wrong with your formula with you
showing it. However, this is what I came up with and it worked. I used A1
as the cell the user would enter that data ("lookup value"). I had the table
in A5:B8.

=IF(COUNTIF(A5:A8,A1)=0,"NA",LOOKUP(A1,A5:A8:B5:B8 ))

What happens in this formula is that it counts the number of times the data
entered matches that data in the table. If it is 0, then it does not exist.
Otherwise it finds the appropriate value.

Hope this helps you out,

Les


"sfeng63" wrote:

I would like to set up a lookup table. when I enter a value in the
spreadsheet, it will find the match value on the column A and print out the
value of column B.

See below
A B
A-01 10.5
A-02 5.6
A-2C 21.2
A-13 11.6

I used lookup function. If the entry is A-2C, the result shows 11.6 instead
of 21.2. Anyone can tell me why? How can I fix the problem? Besides, I
would like to set a function. If my entry does not exist in the table, e.g.
A-1B, I would like to show a "NA" in the result column so I know the input is
incorrect. Can you tell me how to do it?
Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default Lookup function

Make sure both your search argument and your table entries don't have any leading or trailing spaces in them. You can check by
using the LEN() function and compare the result with what you see.

Use VLOOKUP instead of LOOKUP

Formula if search argument is in C1:

=VLOOKUP(C1,A2:B5,2,FALSE)

BTW If you post a question, always supply your formula, the values of the input cells , the expected result and what you got
instead.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"sfeng63" wrote in message ...
|I would like to set up a lookup table. when I enter a value in the
| spreadsheet, it will find the match value on the column A and print out the
| value of column B.
|
| See below
| A B
| A-01 10.5
| A-02 5.6
| A-2C 21.2
| A-13 11.6
|
| I used lookup function. If the entry is A-2C, the result shows 11.6 instead
| of 21.2. Anyone can tell me why? How can I fix the problem? Besides, I
| would like to set a function. If my entry does not exist in the table, e.g.
| A-1B, I would like to show a "NA" in the result column so I know the input is
| incorrect. Can you tell me how to do it?
| Thanks.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to combine an IF Function with a lookup function to determine [email protected] Excel Worksheet Functions 1 December 5th 06 06:09 AM
Sum & Lookup function kestrel Excel Worksheet Functions 5 June 25th 06 09:15 AM
Lookup function or something like it... Newbie1092 Excel Worksheet Functions 0 December 19th 05 04:03 PM
Pivot table doing a lookup without using the lookup function? NGASGELI Excel Discussion (Misc queries) 0 August 2nd 05 05:08 AM
lookup function Eelco Excel Discussion (Misc queries) 1 July 13th 05 06:51 PM


All times are GMT +1. The time now is 12:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"