eibi
Active Member
Given the data in range A1:B6:
black, 2
brown, 1
green, 3
orange, 6
pink, 3
purple, 2
and a set of test values in range D1:D10
green
purple
pink
orange
purple
brown
black
green
orange
pink
When I create an array formula:
The formula returns an array:
Good. I can use this array as input for all manner of other formulas.
But. Suppose I want to use it in an INDEX() formula to lookup and sum the corresponding value (from column B) for all the test values in column D.
I would expect:
to return:
and then:
resolving to a friendly 31
But instead, it ignores the MATCH() array:
and behaves as though I wanted it to:
which resolves to a useless 3
I really want to use an =INDEX(array,MATCH(array,array)) application. But I can't figure it out.
A helper column is an unsavory work-around.
Any suggestions? Am I doing it wrong?
black, 2
brown, 1
green, 3
orange, 6
pink, 3
purple, 2
and a set of test values in range D1:D10
green
purple
pink
orange
purple
brown
black
green
orange
pink
When I create an array formula:
{=MATCH(D1:D10,A1:A6,0)}
The formula returns an array:
{3;6;5;4;6;2;1;3;4;5}
Good. I can use this array as input for all manner of other formulas.
But. Suppose I want to use it in an INDEX() formula to lookup and sum the corresponding value (from column B) for all the test values in column D.
I would expect:
{=SUM(INDEX(B2:B6,MATCH(D1:D10,A1:A6,0)))}
to return:
{=SUM(INDEX(B2:B6,{3;6;5;4;6;2;1;3;4;5}))}
and then:
{=SUM({3;2;3;6;2;1;2;3;6;3})}
resolving to a friendly 31
But instead, it ignores the MATCH() array:
{=SUM(INDEX(B2:B6,MATCH(D1:D10,A1:A6,0)))}
and behaves as though I wanted it to:
{=SUM(INDEX(B2:B6,MATCH("green",A1:A6,0)))}
which resolves to a useless 3
I really want to use an =INDEX(array,MATCH(array,array)) application. But I can't figure it out.
A helper column is an unsavory work-around.
Any suggestions? Am I doing it wrong?
Attachments
Last edited: