Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: How to leave cell empty (instead of 0) when VLOOKUP has no match?

Tags:

excel

I have an excel workbook with 2 worksheet: countries and companies. The companies worksheet is partially filled-in through VLOOKUPs in the countries worksheet, as follows:

countries:

     A       B
1 COUNTRY HOF_LTO
2 Belgium    4
3 Japan      5
4 Spain
5 Sweden     0

companies:

    A         B       C
1 COMPANY  COUNTRY HOF_LTO
2 Belgacom Belgium    4
3 Onkyo    Japan      5
4 Sony     Japan      5
5 ATTM     Spain      0
6 Nokia    Sweden     0

I'm filling the C column by using the formula:

=VLOOKUP($B2;countries!$A$1:$C$5;MATCH(companies!B$1;countries!$1:$1;0);FALSE)

What goes wrong is: even though Spain does not have a HOF_LTO-value in countries, the formula puts 0 as the appropriate value in cell companies!C5. Instead it should leave the cell empty and only put in a zero (0) when it says 0 in the countries tab, as it does in the case of Sweden.

How do I need to edit the formula so it will leave cells empty when there is no country value to match?

like image 870
Pr0no Avatar asked Apr 20 '13 21:04

Pr0no


People also ask

How do I get rid of 0 in Excel VLOOKUP?

You can suppress the zero from displaying by using a custom format along the lines of. Note that the lookup_value should refer to a single cell - not the whole column; change this to the cell that contains your look up value.

What does VLOOKUP do if there is no match?

In Excel, it will return the error value #N/A if it does not find the matched value while using VLOOKUP function as below screenshot shown.


1 Answers

This should solve it:

=VLOOKUP(...) & ""

This will force Excel into making that cell reference a text value, thus preventing the conversion of blanks into zeroes.

Taken from https://superuser.com/a/906954/222835

like image 114
Pillowcase Avatar answered Oct 31 '22 22:10

Pillowcase