If's and VLOOKUPS


Posted by Halsley on July 06, 2001 7:49 AM

I have a VLOOKUP that is working, but I need to add soem more criteria to it.

What I have is a template sheet set up with a date in column A, starting with 1/1/01 and continuing on for thousands of records.. In Column B-Z I have codes that represent the description I need based on code and date.

I have another sheet that contains the data to look in. Column A the Date of the item, Column B the code of the item and finally colum C the actual description of the item ( what I want to return)

In my template, Sheet 1, My VLOOKUP is as follows:
=VLOOKUP(A13,test_dialog!$A$2:$C$18,3,FALSE)

This is pulling the correct description based upon the date.

Now this is where I need help..
I want to be able to only pull the description for the date if the code for the item that was found with the VLOOKUP matches the code in my template..

This function will be copied across the template sheet 1. THe date in Column will never change, but the code at the top of colum b-z will..

I hope that this makes sense!!
Please help if you can!! :)

Posted by Scott S on July 06, 2001 9:02 AM

You could try this:

=IF((VLOOKUP(A13,test_dialog!$A$2:$C$18,1,0)+VLOOKUP(A13,test_dialog!$A$2:$C$18,2,0))=(A13+B13),VLOOKUP(A13,test_dialog!$A$2:$C$18,3,0),"")

This is assuming that your "code" is numberic.

Posted by Halsley on July 06, 2001 9:06 AM

Scott.. I will try that..
My code is NOT numeric though..
It is all text.. will this be a prob??

Posted by lenze on July 06, 2001 9:22 AM

One way would be to incorporate the 2 lookup values in to one arguement by using the CONCATENATE function. Something like VLOOKUP(CONCATENATE(A13,CODE),datasource,3,FALSE). You will have to add a new 1st column to your datasource with the Concatenate formula in it set to join the 2nd and 3rd columns.



Posted by Scott S on July 06, 2001 9:30 AM

No, it will not. If it's text, you can use a concetenate formula to join the date and the code together on both your lookup table, and your data. Then you can do a lookup formula against that. Lenze has posted a formula such as this.