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
Sharyn is an expert trainer. She became the first certified Microsoft® MOUS Authorised Instructor in New Zealand.
She is endorsed by Microsoft® as a qualified Microsoft® Office Specialist and has more than 20 years of experience in the training industry, developing and delivering technology training workshops. Her approach to taking the “techie-speak” out of technology training has placed her as a preferred supplier to many of New Zealand’s leading organisations.
If you enjoyed this you may also enjoy...
Managing, analysing and referencing lists of data becomes easier when you know how to use Excel Tables. There are so many advantages to using Tables which I will cover within this post. Once you see how helpful they are I’m pretty sure you will be using Tables a lot. When you insert a Table over a list
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
If you want to save yourself a huge amount of time when reconciling data, learn how to use VLOOKUP to compare two lists or columns of data. Years ago the Training and Development manager of a large organisation invited me to spend some time in their Accounts department in order to observe how the Accounts team
To group dates by month in a Pivot Table is easy when you know how. Unfortunately, displaying date values in a Pivot Table can produce unexpected results. For example, in the Pivot Table below I have added a Date field to the Column area of my Pivot Table. Every date in the underlying data table is
Finding and removing duplicate data in Excel can be a quick process. However, for many people who haven’t learnt how to do this the quick way in Excel, it can be an absolute chore. One of the many things I love about my job is that I get to work with so many different people from
PROBLEM: having to retype text when your data is in UPPERCASE, lowercase or a Mix oF bOTH. SOLUTION: quickly change the text back to the proper case without having to retype it.