1

I have a document with datas and I want to automatize a research.

for exemple I have

| lastName | firstName | age | result 

And I'd like to get the result row where lastName = Smith, firstName = Jhon and age = 42

I know how to do that with loops but the complexity is hight is there an other solution ?

2
  • 2
    You could use Autofilter. See my answer here for more details. Commented Feb 17, 2014 at 15:22
  • 2
    is result numeric, and if so, will the other columns be unique (no chance of duplication), or if duplication is possible, a sum of the corresponding values is the desired return result? Commented Feb 17, 2014 at 15:55

3 Answers 3

1

You can try This array formula:

=INDEX(D2:D10;MATCH(1;(A2:A10="Smith")*(B2:B10="John")*(C2:C11=42);0)) 

This is an array formula so you need Ctrl Shift Enter to enter the formula

Sign up to request clarification or add additional context in comments.

Comments

1

CRondao has a good solution that will return the first match, and works on any data type. If result is numeric and you want to sum up all matches, this will work:

=SUMPRODUCT(--($A$1:$A$4="Smith"),--($B$1:$B$4="Jhon"),--($C$1:$C$4=42),$D$1:$D$4) 

Note, this is not an array formula.

Comments

0

In cases like this, I usually build a "lookup key" by using CONCATENATE() to combine the values. I can then return results using VLOOKUP() or SUMIF() as required since I find those functions intuitve and easier to write than range offset/index/match formulas.

Here's an image of a demo worksheet, upper left cell is "A1":

MultiLookup.xls

If there are multiple matches, you'll see the total count immediately. You can also use the Auto-Filter, etc., etc....

Here are the formulas in the filter row:

A3: =CONCATENATE(B3,C3,D3) E3: =SUMIF($A$5:$A$10,$A$3,E$5:E$10) F3: =VLOOKUP($A$3,$A$5:$F$10,6,FALSE) 

Since F3 is using VLOOKUP() with option FALSE, it will only return the first result it finds in the list, otherwise it returns #N/A.

These are the formulas in the first row of data, which can be copied down to cover the entire range:

A6: =CONCATENATE(B6,C6,D6) E6: =IF($A6=$A$3,1,"") F6: =IF($A6=$A$3,ROW(),"") 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.