Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default VLOOKUP and "-" characters

Hi,

I'm using VLOOKUP to to convert a set of cells with values based on a lookup
table. Some of these defined values are "C--" and "C-" as per the example
below. Does anyone know why the formula does not give the correct answer?

A B
1 C-- 1
2 C- 2
3 C 3
4 C+ 4
5 C++ 5
6
7
8 C++ 5
9 C+ 4
10 C 3
11 C- 3
12 C-- 3

(B8 fomula =VLOOKUP(A8,$A$1:$B$5,2) delivers correct value)
(B9 fomula =VLOOKUP(A9,$A$1:$B$5,2) delivers correct value)
(B10 fomula =VLOOKUP(A10,$A$1:$B$5,2) delivers correct value)
(B11 fomula =VLOOKUP(A11,$A$1:$B$5,2) delivers incorrect value, should be 2)
(B12 fomula =VLOOKUP(A12,$A$1:$B$5,2) delivers incorrect value, should be 1)

I have tried changing the order of column A array, changing the cell format
of column A to text/general but with the same result. If I replace C-- and C-
with something else then it works. Have tried it with both XP/Excel 2003 and
XP/Excel 2007

Any suggestions please?
/Exxet
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default VLOOKUP and "-" characters

=VLOOKUP(A8,$A$1:$B$5,2)

You need to use the 4th argument to VLOOKUP:

=VLOOKUP(A8,$A$1:$B$5,2,0)

The 4th argument set as 0 or FALSE tells Excel to look for an exact match.

--
Biff
Microsoft Excel MVP


"Exxet" wrote in message
...
Hi,

I'm using VLOOKUP to to convert a set of cells with values based on a
lookup
table. Some of these defined values are "C--" and "C-" as per the example
below. Does anyone know why the formula does not give the correct answer?

A B
1 C-- 1
2 C- 2
3 C 3
4 C+ 4
5 C++ 5
6
7
8 C++ 5
9 C+ 4
10 C 3
11 C- 3
12 C-- 3

(B8 fomula =VLOOKUP(A8,$A$1:$B$5,2) delivers correct value)
(B9 fomula =VLOOKUP(A9,$A$1:$B$5,2) delivers correct value)
(B10 fomula =VLOOKUP(A10,$A$1:$B$5,2) delivers correct value)
(B11 fomula =VLOOKUP(A11,$A$1:$B$5,2) delivers incorrect value, should be
2)
(B12 fomula =VLOOKUP(A12,$A$1:$B$5,2) delivers incorrect value, should be
1)

I have tried changing the order of column A array, changing the cell
format
of column A to text/general but with the same result. If I replace C-- and
C-
with something else then it works. Have tried it with both XP/Excel 2003
and
XP/Excel 2007

Any suggestions please?
/Exxet



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 320
Default VLOOKUP and "-" characters

Add
,FALSE
just before the last parentheses in all your formulas
Without it, it's assuming the data is in ascending sequence; with it, it's
looking for an exact match

"Exxet" wrote:

Hi,

I'm using VLOOKUP to to convert a set of cells with values based on a lookup
table. Some of these defined values are "C--" and "C-" as per the example
below. Does anyone know why the formula does not give the correct answer?

A B
1 C-- 1
2 C- 2
3 C 3
4 C+ 4
5 C++ 5
6
7
8 C++ 5
9 C+ 4
10 C 3
11 C- 3
12 C-- 3

(B8 fomula =VLOOKUP(A8,$A$1:$B$5,2) delivers correct value)
(B9 fomula =VLOOKUP(A9,$A$1:$B$5,2) delivers correct value)
(B10 fomula =VLOOKUP(A10,$A$1:$B$5,2) delivers correct value)
(B11 fomula =VLOOKUP(A11,$A$1:$B$5,2) delivers incorrect value, should be 2)
(B12 fomula =VLOOKUP(A12,$A$1:$B$5,2) delivers incorrect value, should be 1)

I have tried changing the order of column A array, changing the cell format
of column A to text/general but with the same result. If I replace C-- and C-
with something else then it works. Have tried it with both XP/Excel 2003 and
XP/Excel 2007

Any suggestions please?
/Exxet

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,081
Default VLOOKUP and "-" characters

Add a 0 or false as the final argument to your VLOOKUP to force it to find an
exact match

=VLOOKUP(A12,$A$1:$B$5,2,0)

"Exxet" wrote:

Hi,

I'm using VLOOKUP to to convert a set of cells with values based on a lookup
table. Some of these defined values are "C--" and "C-" as per the example
below. Does anyone know why the formula does not give the correct answer?

A B
1 C-- 1
2 C- 2
3 C 3
4 C+ 4
5 C++ 5
6
7
8 C++ 5
9 C+ 4
10 C 3
11 C- 3
12 C-- 3

(B8 fomula =VLOOKUP(A8,$A$1:$B$5,2) delivers correct value)
(B9 fomula =VLOOKUP(A9,$A$1:$B$5,2) delivers correct value)
(B10 fomula =VLOOKUP(A10,$A$1:$B$5,2) delivers correct value)
(B11 fomula =VLOOKUP(A11,$A$1:$B$5,2) delivers incorrect value, should be 2)
(B12 fomula =VLOOKUP(A12,$A$1:$B$5,2) delivers incorrect value, should be 1)

I have tried changing the order of column A array, changing the cell format
of column A to text/general but with the same result. If I replace C-- and C-
with something else then it works. Have tried it with both XP/Excel 2003 and
XP/Excel 2007

Any suggestions please?
/Exxet

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default VLOOKUP and "-" characters

Many thanks to all three of you. You solved my problem. Thanks.

/Exxet

"Duke Carey" wrote:

Add a 0 or false as the final argument to your VLOOKUP to force it to find an
exact match

=VLOOKUP(A12,$A$1:$B$5,2,0)

"Exxet" wrote:

Hi,

I'm using VLOOKUP to to convert a set of cells with values based on a lookup
table. Some of these defined values are "C--" and "C-" as per the example
below. Does anyone know why the formula does not give the correct answer?

A B
1 C-- 1
2 C- 2
3 C 3
4 C+ 4
5 C++ 5
6
7
8 C++ 5
9 C+ 4
10 C 3
11 C- 3
12 C-- 3

(B8 fomula =VLOOKUP(A8,$A$1:$B$5,2) delivers correct value)
(B9 fomula =VLOOKUP(A9,$A$1:$B$5,2) delivers correct value)
(B10 fomula =VLOOKUP(A10,$A$1:$B$5,2) delivers correct value)
(B11 fomula =VLOOKUP(A11,$A$1:$B$5,2) delivers incorrect value, should be 2)
(B12 fomula =VLOOKUP(A12,$A$1:$B$5,2) delivers incorrect value, should be 1)

I have tried changing the order of column A array, changing the cell format
of column A to text/general but with the same result. If I replace C-- and C-
with something else then it works. Have tried it with both XP/Excel 2003 and
XP/Excel 2007

Any suggestions please?
/Exxet



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
=IF(VLOOKUP(C11,Group,2,FALSE)=D11,"True","Not Valid") and =IF(D1 Milky Excel Worksheet Functions 1 August 20th 08 08:38 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
How to replace "#N/A" w "0"when vlookup couldn't find the match? Holly Excel Discussion (Misc queries) 2 July 17th 06 11:48 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 02:26 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"