There are times when you want to return a match for a VLOOKUP based on more than one value. 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.
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.
Vlookup tip: When you count your columns to get the ‘Column_index_num’ be sure to include hidden columns as well. If the ‘Table_array’ includes numerous columns (including hidden columns) try numbering your columns in a row above (as shown in row 12 above). It then becomes very easy to identify the ‘Column_index_num’ of the column you want to look up.
We cover look up functions in our Excel Data Reporting course. If you are dealing with large data lists this course is definitely for you
If you enjoyed this you may also enjoy...
There are times when you want to return a match for a VLOOKUP based on multiple criteria.For example, we may have customers who have multiple branches. However, each branch is recorded under the same customer number. So, how do we look up info for a specific branch if all the branches are using the same customer number?
Need to learn how to quickly remove spaces in Excel? Extra spaces can appear in your worksheet for lots of different reasons such as someone accidentally typing them in or extra characters traveling with data exported out of another software product. In this Blog we will cover two different options to remove those extra spaces, as well
It can be frustrating when you’re trying to type a zero in front of a value or a number in Excel and it just disappears. In this blog we will cover easy ways to take control of your zeros. [Watch on YouTube] / [Subscribe to our YouTube Channel]How to add 0 in front of a number
In this blog we will cover how to change the case of your text in Excel with or without a formula. If you’re a keen user of the Change Case button in Word, Outlook or PowerPoint you may be wondering where it is in Excel. [Watch on YouTube] / [Subscribe to our YouTube Channel]The Change Case
Want to learn how to remove spaces in Excel that even the TRIM function can’t get rid of? Here are two easy fixes that will have you up and running and getting rid of your spaces before you know it. [Watch on YouTube] / [Subscribe to our YouTube Channel]Fix #1 Excel remove spaces in numbersThere’s no doubt
Learn how to change a Pivot Table back to the classic display of version 2003 and earlier. If you were familiar with Pivot tables in Excel versions prior to Excel 2007 you will be very used to the classic display of working with the blue lines of the Pivot Table and the ability to drag and