Vlookup value not working properly in other formulas

Copper Contributor

I am using =vlookup() to obtain values from data that was imported from another workbook (AISC Shapes Database if that helps). I used "Get Data > From File > From Workbook" to get the data into my workbook. The imported data is in a separate sheet/tab in my current workbook. All of the values that I am looking up are formatted as numbers. 

In the sheet that I am working in, the vlookup value returned is correct, so no problems there. When I try to use the vlookup'd value in another formula, that's when I run into problems. 

Example:
A1 is the lookup value
A2 is the =vlookup() function, using A1 as the lookup value, and the imported data as the table array. For this example, lets say the returned value ends up being 6 and is formatted as a number.
A3 is a input value. Lets just say it's 8 and is formatted as a number.

In A4, if I use the formula =A3>A2, the returned value is FALSE though 8 is clearly larger than 6. If I use the formula =A3<A2, the returned value is TRUE though 8 is clearly greater than 6. 

I noticed, however, in A2 if I add +0 to the end of my formula ( =vlookup()+0 ), the returned value in A4 becomes correct. 

Any idea what's going on here?

3 Replies

@mbancroft 

On of your numbers is actually text. Use ISTEXT() to check.

 

@mbancroft 

As a comment in addition, any text is always more than any number, i.e.

="6" > 8

returns TRUE.

@Detlef Lewin it appears that the value is being treated as text, even though the source data, the imported data, and the vlookup cell are all formatted as numbers. I have copied in the data instead of importing it and that did the trick for now. Thanks for your help!