Question

Ok, this is going to be a difficult question to ask, but I'm gonna give it a try.

I have three sheets (Sheet1, Sheet2, Sheet3) in one worksheet (Worksheet).

Sheet1 contains ~100,000 rows with columns Company (A), Holding (B), Product (C), Year (D), Spend (E).
Sheet2 contains 100 rows with columns Company (A), Holding (B), Product Spend in certain Year (C).
Sheet3 contains 100 rows with columns Company (A), ID (B), Variant1 (C), Variant2 (D), Variant3 (E).

What I want, is in Sheet2 to calculate the Product Spend in certain Year. I've been able to do this as a test in Sheet1 by using the function SUMIFS. So in Sheet1 I used:

=SUMIFS(E:E,A:A,"Fake Ltd",B:B,"Fake Holding",C:C,"Dog Food",D:D,"2011")

The problem is that the company names aren't the same in all sheets. I tried to solve it via a FuzzyFind, but that is not working perfectly enough. So I decided to change my methods, and that's why Sheet3 exists. This sheet contains all different name variants of one company in one row (similar to a relational database).

Now I need to use this SUMIFS function in Sheet2 where the company name relates to all possible other company names in Sheet3 so it can sum the company names that appear in Sheet1 as if it were one company name. The column Company in Sheet3 is the 'chosen' company name and also the one used in Sheet2. It's Sheet1 that gives the problem.

So somehow I need to combine SUMIFS with VLOOKUP in Sheet2, but I am not sure how. Anyone any clues? I'll do my best to improve my question, I can imagine if I didn't do the best job explaining.

Was it helpful?

Solution

Unless Sheet1 is read-only, just add another column to Sheet1 in which you look up the proper company name from Sheet3. Then build your SUMIFS in Sheet2 based on this column.

If you're using Excel 2010/13, consider installing Powerpivot as an alternative. Here you only need to link the table from Sheet1 with the table from Sheet3 via the Company name column - and then produce a pivot that gives you all the aggregations you need!

OTHER TIPS

I think what you're after is excel's array functionality.

http://office.microsoft.com/en-au/excel-help/introducing-array-formulas-in-excel-HA001087290.aspx

For Sheet C, I'd suggest repeating the pattern: Company, Variant

That way, you can cross reference any and all companies that match in C without trying to compare against offset 1, 2, 3 ... n

You can then combine the results and use that to match against multiple criteria:

http://blog.contextures.com/archives/2012/07/12/check-multiple-criteria-with-excel-index-and-match/

(the criteria is essentially the union of all rows that match both a company name and a year).

Once you've got the array of the rows that match, you can then apply your sumif over the top.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top