When checking if a value exists in a range, using COUNTIF is quicker, easier and less prone to errors.
This table shows the returning values for each formula which you can paste to C2 and D2 and drag down:
- C2: Countif:
- D2: Vlookup:
=VLOOKUP(B2, $A$2:$A$10, 1, 0)
|1||Name||Names to Check||Countif||Vlookup|
Why Use COUNTIF Instead of VLOOKUP?
When you just want to determine if a value exists in a list then I recommend using COUNTIF over VLOOKUP. It has a few advantages that make it more efficient, and also give you more insight to your data.
Here are 3 reasons to use COUNTIF instead of VLOOKUP (when you just want to see if a value exists in a range of cells):
- The COUNTIF function only has two arguments making it really fast and easy to write the formula. VLOOKUP has four arguments.
- COUNTIF returns the total number of matching values in the range, so you can see if there is more than one matching value. VLOOKUP cannot do this, it only returns the first match.
- If the value does not exist, COUNTIF will return a zero (0). You do not need to worry about a formula error. With VLOOKUP, the formula would return an error and you would use and error handling function like IFERROR to handle the error. Here is a comparison table of the list above, just in case your boss asks why.
The COUNTIF returns a number greater than or equal to 1 if the value exists in the list. It returns a zero if the value does not exist. The VLOOKUP formula is going to return the matching value from the list. VLOOKUP returns a #N/A error if it can’t find the value in the list.