Complex Lookup Question

T

TB@work

Here is what my spreadsheet looks like

Load# Stop Stop Seq. Final Dest.
1234 Dayton 1 Columbus
1234 Dublin 2 Columbus


I want a formula that will look by load number, then stop seq. and end with
the location. For instance I would want to find stop seq. 1 for load 1234
to return Dayton. Thanks for your help.
 
R

ryguy7272

With your data in A2:D3, and Load# in F2 and StopSeq. in G2, enter this in H2:
=INDEX(B2:B101, MATCH(F2&G2,A2:A101&C2:C101,0))

Hit Ctrl + Shift + Enter, not just Enter
 
T

T. Valko

Nit pick...

When the data is potentially ambiguous concatenating can cause problems.

123...Canton...41...Salem
1234...Dayton...1...Columbus
1234...Dublin...2...Columbus

F2 = 1234
G2 = 1

=INDEX(B2:B101, MATCH(F2&G2,A2:A101&C2:C101,0))

Returns Canton when the correct result should be Dayton.

If you're going to concatenate it's usually better to add a "delimiter" to
make every combination unique.

=INDEX(B2:B10, MATCH(F2&"^^"&G2,A2:A10&"^^"&C2:C10,0))

Returns the correct result, Dayton.

Another way...

=INDEX(B2:B10, MATCH(1,IF(A2:A10=F2,IF(C2:C10=G2,1)),0))

Or...

=INDEX(B2:B10, MATCH(1,(A2:A10=F2)*(C2:C10=G2),0))

The IF version is slightly more efficient on large ranges.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Index Problem 2
Index Question 0
Offset/Match Double Lookup 4
Lookup Help 3
Lookup Question 1
Vook up help required 9
Return Corresponding Value Based on Comparing Two Sheets of Data 6
formula question 3

Top