erik.van.geit said:
Hi, Aladin,
Wrz (OP) didn't confirm my table was OK
little typo ";" should be "," else I'm missing something
=INDEX(Kütusetabel!$K$3:$K$200
,MATCH(1,(Kütusetabel!$C$3:$C$200=$A$1)*(Kütusetabel!$D$3:$D$200=$A4),0))
is this a good alternative or is it slower
(I like this syntax)
=INDEX(Kütusetabel!$K$3:$K$200,MATCH($A$1&$A4,Kütusetabel!$C$3:$C$200&Kütusetabel!$D$3:$D$200,0))
(confirm with Control-Shift-Enter)
best regards,
Erik
The OP appears to have semi-colon as list-separator.
SumProduct (and SumIf) can be sometimes called in a retrieval formula
if the object of the retrieval is a number and there are no duplicate records. The OP wants to retrieve while the data is non-numeric. Also, there is ordinarily no need to invoke such formulas.
What I provided
{=INDEX(Kütusetabel!$K$3:$K$200;MATCH(1;(Kütusetabel!$C$3:$C$200=$A$1)*(Kütusetabel!$D$3:$D$200=$A4);0))}
fits the data structure the formula the OP posted implicates.
Is this INDEX formula slower?
Yes, it is slower than ordinary:
=INDEX(Kütusetabel!$K$3:$K$200;MATCH($A1&"#"$A4;Kütusetabel!$E$3:$E$200;0)
where E3 on Kütusetabel concatenates C3 and D3 with =C3&"#"&D3.
It's faster than:
=LOOKUP(2,1/((Kütusetabel!$C$3:$C$200=$A$1)*(Kütusetabel!$D$3:$D$200=$A4)),Kütusetabel!$K$3:$K$200)
which is an idiom to retrieve the last instance of the values of interest (see
http://tinyurl.com/7ysq5 for an explanation).
INDEX/MATCH with MATCH's match-type set to 1 is as fast as LOOKUP. That is, 2 function calls against 1 does not make any difference. That is, the division that LOOKUP needs which explains the speed difference.
What would be the choice, given the data that you provided?
Book9 |
---|
|
---|
| A | B | C | D | E | F | G | H | I |
---|
1 | Field-1 | Field-2 | Field-3 | Concat | | | LookupValue-1 | LookupValue-2 | Result |
---|
2 | A1 | B1 | C1 | A1#B1 | | 1) | A2 | B2 | C2 |
---|
3 | A2 | B2 | C2 | A2#B2 | | 2) | A2 | B2 | C2 |
---|
4 | A2 | B3 | C3 | A2#B3 | | 3) | A2 | B2 | C4 |
---|
5 | A2 | B2 | C4 | A2#B2 | | | | | |
---|
6 | | | | | | | | | |
---|
|
---|
If we want the first match:
1) =INDEX(C2:C5,MATCH(G2&"#"&H2,D2:D5,0))
which is supported by a concatenation range.
2) {=INDEX(C2:C5,MATCH(1,(A2:A5=G3)*(B2:B5=H3),0))}
If we want the latest match:
3) =LOOKUP(2,1/((A2:A5=G4)*(B2:B5=H4)),C2:C5)
The latter will come up with the only match (thus the first match so to speak) if there are no duplicate records.
Note that (3) does not need control+shift+enter for LOOKUP like SUMPRODUCT always operates on computed arrays. A formula that operates on computed arrays is by definition an array formula regardless whether it needs control+shift+enter or not.
Also be aware that replacing 2 with 1 would work with conditionals evaluating text arrays, it won't get you the first match in other cases.