VLOOKUP to match certain criteria under a certain column header
-
08-12-2019 - |
Frage
I'm not quite sure how to do this.
I'm not sure if VLOOKUP's are the right tool to use for this.. considering the index im looking for is a column header name and not a number?
Here's what I have so far..
On one sheet I have my information. Three columns are dedicated to defining the data and the 4th,5th and 6th rows are the data themselves.
Description Description Description Harry Paul David
Hairy Red Foot Very No Kinda
Ugly Blue Hair None A little A lot
Pretty White Dress Yes Average Sparkle
Then, on another workbook. I want to import the data from the other sheet using this function. I have a blank table with no data in it.
Description Description Description Harry Paul David
Hairy Red Foot
Ugly Blue Hair
Pretty White Dress
I want to set it up so that if a certain cell on the import sheet. Has a cell which matches a certain criteria on the source data sheet (i,e, description1 = Hairy, description2 = Red, Description3 = Foot in the Harry column
). It will display Very
.
Can anyone provide any information on what I need to research? I believe it is a dynamic lookup?
Edit: I forgot to mention the the names might move around between imports (So Dave might come before John etc).
I guess this can achieved with a combination of SUMIF statements and VLOOKUP's?
Lösung
1) Create a column where you concatenate your lookup keys, separated by some character (hyphen would work in the example you give) and use this value as your lookup key
2) Make sure your source sheet is sorted, and use false as the last parameter in the VLOOKUP function
Andere Tipps
Depending on requirements, you may be able to use Advanced Filter which would probably be quicker than multiple lookup formulas.
First make sure the description headers are unique on each sheet (Desc1, Desc2, Desc3), then select the import sheet and choose Advanced Filter from the Data Tab with the options:
Action: Copy to another Location
List Range: [Book1]Sheet1!$A$1:$F$4 (Source Workbook)
Criteria Range: $A$1:$C$4 (Descriptions)
Copy to: $A$1:$F$1 (Headers)
Unique Records Only: Check
This will return all unique matching records in the same order as the source data. Just repeat the command as needed and any existing values will be overwritten.
writablesheet.addCell(new Formula(0, i, "VLOOKUP(A"+i+",'Sheet2'!A$"+i+":B$6,2,0)"));
when u enter sheet name it should be in single quotes
and i indicates row index
sure this ll help you people