VLOOKUP Error with IF function

Copper Contributor

Hi!

I'm having an issue with the file I'm working on - basically how the file works is that you paste a raw data dump from a database and since it has various amounts of random spaces in the cell values I am using a formula to take out all the numbers from a given cell as every cell value begins with a code - text value (eg. 123456 - Cell Value A). So that cell just returns this 123456. Unfortunately some of the text values also contain numbers (eg. 123456 - Cell Value B2) so my formula returns 1234562, instead of 123456. To clean this up I am using an IF function (=IF(LEN(A1)=6,A1,LEFT(A1,6)) so to take the 6 digit value if it already is like this or cut any additional characters if needed.

 

This is where the problems begin - in the next tab I am doing a VLOOKUP against this column with the IF value and it seems that it only finds only 1 variant of the IF function (the one where the value already has 6 characters, not the one where it cuts additional characters). The formats are the same, I am not sure what the issue is. Do you have any ideas what's wrong?

 

Many thanks for the help in advance

2 Replies
what is the formula you are using with VLOOKUP?

@Magda_P1212 

How about using

 

=--LEFT(A1,6)