Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress #N/A returned by Google Sheets vlookup

I have a Google Sheet (example) with a basic vlookup to create a summable column. It returns "#N/A" for every search key not found, and attaches the following error to those cells:

Error Did not find value '[email protected]' in VLOOKUP evaluation.

After much searching the only solution I found was to wrap the vlookup in an IF(ISNA()), given in How to link various Google spreadsheets using IMPORTRANGEs that contain VLOOKUP formulas without getting #N/A returned?. This works, but it really seems like I should not have to do this. Is there another way?

like image 544
Skipwave Avatar asked Jun 16 '16 16:06

Skipwave


People also ask

What do you mean by suppress?

Definition of suppress transitive verb. 1 : to put down by authority or force : subdue suppress a riot. 2 : to keep from public knowledge: such as. a : to keep secret. b : to stop or prohibit the publication or revelation of suppress the test results.

Does suppress mean control?

To suppress something means to curb, inhibit, or even stop it.

What is the opposite of suppressive?

Opposite of the action of suppressing something such as an activity or publication. encouragement. incitement. provocation.


2 Answers

Update 2019-03-01: The best solution is now =IFNA(VLOOKUP(…), 0). See this other answer.

 

You can use the following formula. It will replace the #N/A values returned by VLOOKUP(…) with 0.

=SUMIF(VLOOKUP(…),"<>#N/A") 

How it works: This uses SUMIF() with only one value to sum up. So the result is that one value – if unequal to #N/A, according to the condition. If the value is #N/A however, the sum is zero. That's just how SUMIF() works: if no values match the conditions, the result is 0, not NULL, not #N/A.

Advantages:

  • Compared to the solution =IF(ISNA(VLOOKUP(…)),"",VLOOKUP(…)) referenced in the question, this solution contains the VLOOKUP(…) part only once. This makes the formula shorter and simpler, and avoids the mistakes that happen when editing only one of the two VLOOKUP(…) parts.

  • Compared to the solution =IFERROR(VLOOKUP(…)) from the other answer, errors are not suppressed as that would make detecting and debugging them more difficult. Only #N/A values are suppressed.

like image 164
tanius Avatar answered Sep 24 '22 05:09

tanius


=IFNA(VLOOKUP(...), "")

Not sure if this has changed recently, but the IFNA implementation supports a single listing of the VLOOKUP now. That is, you don't have to wrap it in another IF.

An advantage there is that you could choose "", 0, NULL, etc. as the value to show on failure.

like image 24
Adam C Avatar answered Sep 23 '22 05:09

Adam C