• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Vlookup multiple lookup values

sguna1982

Member
Dear Team,

I coming back with vlookup excel doubt. I have attached excel sheet, in this i am looking formula like vlookup to match the value based multiple lookup values but table array, col index will remain the same.

Please help me on this to get the formula.

Regards,
Guna.S
 

Attachments

  • Vlookup multiple lookup values.xlsx
    9.8 KB · Views: 8
My recommendation would be to have all the Client Codes (lookup values) in a single column, but if that can not be helped, with your example workbook, formula in cell I3 could be:
=SUMPRODUCT(ISNUMBER(SEARCH("|"&G3,"|"&$A$3:$A$10&"|"&$B$3:$B$10&"|"&$C$3:$C$10))*$D$3:$D$10)
 
Sure thing. HEre's the whole formula, with color added for explanation
=SUMPRODUCT(ISNUMBER(SEARCH("|"&G3,"|"&$A$3:$A$10&"|"&$B$3:$B$10&"|"&$C$3:$C$10))*$D$3:$D$10)
Let's look at the blue part first. In order to look at all 3 of the columns of client codes at the same time, to see which one contains the value we want, we concatenate them together. However, we also want to make sure that by concatentating two unique values, we don't accidentally create a third (e.g., if I'm looking fof baseball, and one list had "base" and the next had "ball", don't want to put them together and accidentally make "baseball". So, before each column we add a pipe symbol, something that 99.9% of the time doesn't occur naturally in data. :)

Now that we have a searchable array, we look at the red part. This is where we state what to look for. Since we added pipe symbols to our search arrach, we concatenate a pipe symbol to the lookup value. Now, our SEARCH function will produce an array, with either an error (saying that the value wasn't found) or a number (indicating position within value that our search value was found). Example of what that looks like:
{#N/A!,#N/A!,#N/A!,5#N/A!}
This gets fed to the ISNUMBER function, which converts this ugly thing into an array with just TRUE/FALSE values.
{False,False,False,True,False}
XL also treats True/False = 1/0.
{0,0,0,1,0}
NOTE: I made an assumption at this point that the search value was only found in one place. You'll see why this is important in next step.

The SUMPRODUCT then takes that array and multiplies it against our values, the percentages. So, if the Green array looked like:
{10,20,30,40,50}
when we mutiply it against the 1/0 array we built, we'll get:
{0,0,0,40,0}
and then finally SUMPRODUCT spits out the sum of that array, which is 40. For our assumption, if 2 rows had the search value, then 2 different percentages would have been fed into the SUM, and our answer would be wrong.
 
First of all Thanks for your tricky formula!!!

Excellent explanation.

Here is one more scenario. If i have include one more percentage and dates also, how come i ll do the changes in the formula.

I have attached excel sheet for your reference.

Thank you very much...:)
 

Attachments

  • Vlookup multiple lookup values.xlsx
    10.1 KB · Views: 3
Perfecting Fromula From Luke:

=SUMPRODUCT(ISNUMBER(SEARCH("|"&J3,"|"&$A$3:$A$10&"|"&$B$3:$B$10&"|"&$C$3:$C$10))*(K3=$D$3:$D$10)*$E$3:$E$10)+SUMPRODUCT(ISNUMBER(SEARCH("|"&J3,"|"&$A$3:$A$10&"|"&$B$3:$B$10&"|"&$C$3:$C$10))*(K3=$F$3:$F$10)*$G$3:$G$10)
 
Thanks for the reply.

Formula is working fine, but its only working for the exact dates while i am changing the date as greater then or equal to (>=) in the formula its not working.

I have attached excel sheet for your reference.

Please help to me to get this resolved.

Thanks.
 

Attachments

  • New Vlookup multiple lookup values.xlsx
    10.6 KB · Views: 3
Hi Guna,

If you can arrange your raw data as per attached file (Green Cells) than the extraction become easy (Blue Cells) in the attached file.

Regards,
 

Attachments

  • Vlookup multiple lookup values (1).xlsx
    11.1 KB · Views: 5
Back
Top