Share via

Vlookup returning 0's instead of blanks when no data evident

Anonymous
2012-01-04T02:36:25+00:00

I am bringing data from one sheet to another based on matched ID's. Where the ID doesn't exist it is returning blanks or #N/A which is fine, but if the ID exists and the cell I am looking at is blank it return a 0 instead of a blank - some of my cells have 0 in them so I can't differentiate between what should be a 0 and what should be a blank. See example below?

ID Service 1 Number Minutes Service 2 Number Minutes
10-101 Service Type A 2 70 Service TYPE B 4 120
10-102 Service TYPE B 1 30
10-103 Service TYPE B 1 45
10-104 Service TYPE B 1 60 Service Type C 2 0
10-105 Service Type A 1 0 Service TYPE B 2 60
10-106 Service Type C 1 30
10-107 Service TYPE B 1 0 Service TYPE B 1 60

using the formula of =VLOOKUP(A2,...,2,FALSE) etc. it's returning this:

ID Service 1 Number Minutes Service 2 Number Minutes
10-101 Service Type A 2 70 Service TYPE B 4 120
10-102 Service TYPE B 1 30 0 0 0
10-103 Service TYPE B 1 45 0 0 0
10-104 Service TYPE B 1 60 Service Type C 2 0
10-105 Service Type A 1 0 Service TYPE B 2 60
10-106 Service Type C 1 30 0 0 0
10-107 Service TYPE B 1 0 Service TYPE B 1 60

whereas I want the highlighted zero's to be blank - any ideas??

Thanks

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2012-01-04T02:49:51+00:00

    > .. if the ID exists and the cell I am looking at is blank it return a 0 instead of a blank

    You could try something like this

    =IF(VLOOKUP(D1,A:B,2,0)="","",VLOOKUP(D1,A:B,2,0))

    to return the desired blanks ("") for matched cases with blanks in the return col

    100+ people found this answer helpful.
    0 comments No comments

23 additional answers

Sort by: Most helpful
  1. Anonymous
    2014-04-30T10:14:52+00:00

    I'd say a SUBSTITUTE would be more efficient than an IF that contains two vlookup operations, like this:

    =SUBSTITUTE(VLOOKUP(A1, $F1:$G$7, 2),"0","")

    It's difficult to know how Excel processes the formula internally, but at least you know for sure that the expensive VLOOKUP is processed only once with the above.

    That's dangerous. If your returned data contains 0 this will produce wrong result.

    For numbers, Max's solution is the safe workaround.

    If your data is text and you want a blank rather than a 0 in the result, you should do:

    ="" & VLOOKUP(......)

    to eliminate the 0.

    100+ people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2014-03-03T16:14:46+00:00

    I'd say a SUBSTITUTE would be more efficient than an IF that contains two vlookup operations, like this:

    =SUBSTITUTE(VLOOKUP(A1, $F1:$G$7, 2),"0","")

    It's difficult to know how Excel processes the formula internally, but at least you know for sure that the expensive VLOOKUP is processed only once with the above.

    20+ people found this answer helpful.
    0 comments No comments
  3. Anonymous
    2017-09-11T05:15:05+00:00

    Hi,

    try append  &"" at the end of VLOOKUP => =VLOOKUP(A2,...,2,FALSE)&""

    Giuseppe

    Excellent Giuseppe! This solution played it the best for what I needed. It returns blank for blank and the looked-up value for everything else which is not blank.

    10+ people found this answer helpful.
    0 comments No comments
  4. Anonymous
    2017-04-21T16:17:03+00:00

    Hi,

    try append  &"" at the end of VLOOKUP => =VLOOKUP(A2,...,2,FALSE)&""

    Giuseppe

    10+ people found this answer helpful.
    0 comments No comments