# Excel – How can I do a VLOOKUP based on more than one value?

There are times when you want to return a match for a VLOOKUP based on two values, not one.  For example, we may have customers who have multiple branches.  Each branch is recorded under the same customer number.  So how do we look up info for a specific branch if all of the branches are using the same customer number?

In the example below you will see that each branch of the same company has the same ‘Customer No’.  Therefore if we need to find a match based on the ‘Customer No’ AND the ‘Branch’ we can use the CONCATENATE function to pull these two values together to be used for the Lookup Value.  This then allows us to utilise the VLOOKUP function.

## Using the CONCATENATE function to join the values

The CONCATENATE function offers the ability to combine data held in separate cells into the same cell. Each single cell reference can be pulled together into a single string.

In the example above the Concatenate function is used to combine the content from column A and column G. For example, in cell B14 the formula is =CONCATENATE(A14,G14).  This then creates the unique value of CustomerNoBranch.

In cell E9 the CONCATENATE function is used to pull the ‘Customer No’ in cell E4 and the ‘Branch’ in cell E5 together.  This is then used to find an exact match in column B.

=VLOOKUP(CONCATENATE(\$E\$4,\$E\$5),\$B\$13:\$H\$25,3,0)

If at any time the data in cell E4 or E5 changes the result will be updated.

## Hiding #N/A errors when the VLOOKUP value isn’t found

The model above is reliant on the user entering both the customer number and branch correctly.  If the data is entered incorrectly the #N/A (Not Available) error will be displayed.

To avoid this try using the IFERROR functionto replace the errors with a prompt.  In the example below if the lookup value can’t be found the text “not found’ will be displayed instead.