0

I have to do a computed fields in Excel table which summarize values from a table joined with values from a domain table. E.g. have table of goods with name and count and domain table pricelist with goods name and price. The goal is to lookup price for each goods row, multiply it by the price and sum this all together. Some of the goods lines may repeat and some may miss so it is not possible to do the vector product.

In fact the real case is a bit more complicated.

I can do a lot with MATCH and INDEX functions and array formulas. But my showstopper is that INDEX function cannot return array of found values based on array of indices passed in. This formula always ends up with value 1, not an array as I would expect:

{=COUNT(INDEX({1,2,3},{3,2,1}))}

Just note that I cannot use LOOKUP functions as they require sorted lists...

2
  • 1
    Would it help to use VLOOKUPs, which can handle unsorted lists when you set the optional 4th argument to FALSE or 0? Commented Dec 13, 2012 at 21:42
  • No, it can't do the thing. Commented Dec 15, 2012 at 20:48

1 Answer 1

2

INDEX (like VLOOKUP) doesn't return an array of values (except in some convoluted circumstances)

If you have Name1 and Count in first table and Name2 and Price in second table then you can get the grand total price with this formula

=SUMPRODUCT(Count,SUMIF(Name2,Name1,Price))

[The SUMIF part is doing what I assume you are trying to do with INDEX]

Assumes that Name2 in second table has no repeats

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

1 Comment

EXCELlent, thats it. All the time, I was trying to "vectorize" the inputs, not the conditions!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.