Hi
Ineed a vlookup formula to search on more than one number, if this is possible please.
Please see attached sheet.
Many thanks
Braddy
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Lookup more than one number (Excel 2002)
Hi Braddy
The attached spreadsheet shows a possible solution using the INDEX and MATCH functions in an array formula. To enter the formula you use Control+Shift+Enter
The 2 values to search for are concatenated and this value is then used to search through an array made up of concatenated values from the lookup table. Unfortunately it is not a particularly easy or elegant solution.
In the spreadsheet the values to lookup are in cells A2 & B2, the result in Cell C2 and the lookup table in cells E2:G8
I assume AddNum is the lookup range, and col 4 is the value to get. I will also assume that the item code is in column1 and the Cust code in COl 2 of the range.
If the item code and Customer are each unique in their respective lists, you could do a MATCH on each and if the rows were equal indx on the “value” list to get that row. This will not work if either is not unique
This formula could look like:
=IF(MATCH(A2,INDEX(AddNum,,1),0)=MATCH(B2,INDEX(AddNum,,2),0),INDEX(AddNum,MATCH(B2,INDEX(AddNum,,2),0),4),””)
If they are not unique and there is only 1 such combination this ARRAY formula should work (confirm with ctrl-shift-enter)
=SUM(IF((INDEX(AddNum,,1)=A2)*(INDEX(AddNum,,2)=B2),INDEX(AddNum,,4)))
If there are multiple combinations, the above will sum them up (you can replace the sum with other stat functions (count, average, min, max, std, etc) if desired.
If your needs are different than outlined, you will need to elaborate and probably create a custom function.
Steve
Hi Steve
The codes are not unique they repeat several time in the sheet , for instance the Item code will appear along side several different customer codes. hence the neeed to make sure they match .
So I will try the second formula the array ,
Thanks to you and Tony for your reply.
Braddy
You could do a multi-key lookup by extending your lookup table (addnum) with an additional column by concatenating its first two columns…
Let B2:E20 on Sheet2 house the lookup table with Item Code in B and Customer in C.
In A2 enter & copy down:
=B2&”,”&C2
Now select A2:E20 and name the selection “addnum”.
This setup allows you to invoke an ordinary VLOOKUP formula…
=VLOOKUP(A2&”,”&B2,addnum,5,0)
where A2 houses an Item Code interest and B2 a customer of interest on, say, Sheet1.
See attachment.
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.