sumproduct problem

wrz

New Member
Joined
Nov 16, 2005
Messages
3
Hey, the problem is that i want to use sumproduct based on 2 ranges to search from third range, the problem is that in the third range are codes which include text strings : TT9298473 so in the 1-st range are car registration numbers and in the second range are dates, if they match the formula should output the corresponding code from 3-rd range

Is there a way that sumproduct accepts text strings ???



My current formula looks like this :
=SUMPRODUCT(--(Kütusetabel!$C$3:$C$200=$A$1);--(Kütusetabel!$D$3:$D$200=$A4);(Kütusetabel!$K$3:$K$200))

Would someone PLEASE post a solution I really need the solution
 
Hi barry houdini,

Just a slight modification to the formula:

=LOOKUP(1,1/((A1:A4=B10)*(B1:B4=C10)),C1:C4)

The formula would grab the first match not the last match.

Remember this,

In the world of Kung Fu, Speed determines the winner (y)
Book555555.xls
ABCDEF
1A1B1C1
2A2B2C2
3A2B3C3
4A2B2C4
5
6
7
8
9A1B1
10A2B2
11
12
13C1C2
14
Sheet1
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi vane0326:

Let us look at the following illustration ... this may clear up the situation when there is more than one match ...
Book1
ABCDEF
1A1B1C1
2A2B2C2
3A2B3C3
4A2B2C4
5A1B1C7
6
7
8FirstMatchLastMatch
9A1B1C1C7
10A2B2C2C4
11
Sheet5


formula in cell D9 is an array formula ...

=INDEX($C$1:$C$5,MATCH(1,1/(($A$1:$A$5=B9)*($B$1:$B$5=C9)),0))

and the formula in cell E9 is ...

=LOOKUP(2,1/(($A$1:$A$5=B9)*($B$1:$B$5=C9)),$C$1:$C$5)
 
Upvote 0
erik.van.geit said:
Hi, Aladin,
Wrz (OP) didn't confirm my table was OK :confused:
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
ABCDEFGHI
1Field-1Field-2Field-3ConcatLookupValue-1LookupValue-2Result
2A1B1C1A1#B11)A2B2C2
3A2B2C2A2#B22)A2B2C2
4A2B3C3A2#B33)A2B2C4
5A2B2C4A2#B2
6
Sheet1


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.
 
Upvote 0
Aladin,
this is science :)
a good start to write a book on this stuff !
(or did you write one already?)

kind regards,
Erik
 
Upvote 0

Forum statistics

Threads
1,215,137
Messages
6,123,252
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top