EXCEL: Combining SUMIFS with multiple VLOOKUPs due to small variances in names - excel

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.

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!

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.

Related

Matching mulitple criteria across 2 sheets and pulling some data from that match in excel

I have two sheets of data, one is a list of 4000+ companies and some data about the company (including a CUSIP and an issue date). The other lists stock prices per day for a said list of companies spanning multiple years.
I need to match the CUSIP and the issue date from the first sheet with that of the second and extract a number from sheet 2 where both where a match and put it in sheet one in a colomn next to the other data from that company.
Sheet 1
Sheet 2
I tried =VLOOKUP(E1076&O1076;Sheet1!A:Sheet1!K;11;FALSE) but all this did was give me a #NAME error same for when I tried to do this on the same sheet
I tried =INDEX(W:AP,MATCH(1,(X:X=D5)*(AE:AE=N5),0),42) but that just tells me it isn't a formula to begin with
Combined Sheets
In Column R:
{=INDEX(AG,MATCH(D2&N2, U&AB,0))}
will work for you but will likely be slow (make sure to enter with ctrl+alt+enter)
You can try and mitigate the lag by using defined ranged (e.g. U2:U4000&AB2:AB4000) but since your list is ever growing I'll guess that the lag will come back pretty quick.
To keep things faster, I suggest you use a helper column where you concatenate U and AB. Let's say column AC:
=U2&AB2
(copied all the way down)
You can then use a simple INDEX/MATCH:
=INDEX(=INDEX(AG,MATCH(D2&N2, AC,0))
You could also concatenate D and N to another column and use that column as your lookup value.

Sum values in different rows if they match

I need some help regarding an issue that I was not able to solve. I tried to figure it out but without reaching my goal. This is what I have:
In sheet 1 I have estimated active customers for a period of time, where columns are months and rows are departments/states:
Sheet 1
Then, in sheet 2, I'm forecasting sales and need excel to return values from sheet 1 depending on which month we are kicking-off for each department:
Sheet 2
Of course, the kick-off month may vary for each department and values from sheet 1 should accommodate according to the selected month on column B in sheet 2.
And within C2:I4 I have used this formula:
=IFERROR(IF(C$1>=$B2,INDEX(Sheet1!$B$2:$F$4,MATCH($A2,Sheet1!$A$2:$A$4,0),MONTH(C$1)-MONTH($B2)+1),""),"")
The formula above actually works great when departments are not repeated in sheet 1 but, what would happen if departments are repeated (as shown in sheet 1) and I have to sum values from the same department and show the result on each cell in sheet 2?
I look forward to your kind help!
Thanks!
Try using SUMIF like this:
=IFERROR(IF(C$1>=$B2,SUMIF(Sheet1!$A$2:$A$4,$A2,INDEX(Sheet1!$B$2:$F$4,0,MONTH(C$1)-MONTH($B2)+1)),""),"")
Please try this formula, designed for your Sheet2!C2 cell.
=IFERROR(SUMIF(INDEX(Rodrigo,,1),$A2,INDEX(Rodrigo,,MONTH(C$1)-MONTH($B2)+1)),"")
In order for this formula to work you should declare a named range comprising of your range Sheet1!A2:F4. My formula calls the range Rodrigo. If you choose another name please change the name in the formula accordingly.
You can exclude zero results by adding a further IF condition to the formula. I would prefer to do that via cell formatting, like 0;0;; where the third semi-colon determines that a zero will not be shown. You can also suppress display of zeros for the entire sheet in the worksheet options.

Sum the product of multiple vlookup or index/match results

I have 2 worksheets, one with multiple columns of data where rows are given years and the other columns are values under the headers of names, and the second sheet lists rates by year (column) and by name (row).
I am trying to take each value in a given column of sheet1 and multiply it by the relevant rate (found by matching the year of each row and the name of its column to the table in sheet2) and then sum the products by name, but can only use a single cell to do all this.
So far I've tried SUMPRODUCT and got to =SUMPRODUCT(O$24:O$514,INDEX(Rates!$A$2:$X$200,MATCH(O$23,Rates!$A$2:$A$67,0),MATCH($D$24:$D$514,Rates!$A$2:$X$2,0))) but this seems to fall down at the MATCH($D$24:$D:$514,Rates!$A$2:$X$2,0) part, even entering as an array.
I've currently resorted to a clumsy series of SUMIF(2016)*INDEX/MATCH(2016 rate)+SUMIF(2015)*INDEX/MATCH(2015 rate) etc, but would really like to have forward compatibility without relying on formulae being updated!
slightly simplified image of the workbook, thanks for any help!

excel - advanced vlookup or other formula?

I have a question regarding excel and I am looking for a formula that can help me transport my data from one sheet to the other. I have some experience with excel, however I am not a pro at it, so I apologize if this is a very trivial question but would also be happy since that would mean it probably has a very trivial answer! Unfortunately I do not have enough reputation points yet to post images, but I will try to explain it as clearly as possible.
Basically I am creating an excel template and the goal is to have 2 sheets in excel.
In the first sheet I have a column with following input in rows A1 - A3: Sales Region,
Country, Account ID's.
Above is the example of column A; from column B --> x; I will put e.g.
Americas, US and as many account numbers as there are in that specific country.
However on the second sheet it gets a bit complicated. My goal is that all the account numbers from sheet 1 irrespective of their sales region and country (which also means irrespective of their column) will automatically be listed on the second sheet.
The second sheet will be organized in the following way:
From column A - C; sales region, country and account ID.; from column D - x financial information for each account.
As a first step I want all the different account ID's from the different columns on the first sheet to be listed under column C (account ID's) on the seconds sheet.
As a second step I want column A - B to be automatically filled out according to account number by accessing the information in which column and thus sales region and country the account is in on sheet one.
I don't think a simple vlookup would do the job, especially for step 1, since I want the account ID's from many different columns and rows in sheet 1 to be listed in just one column....
hope it is clear enough! Would appreciate any help! :) thanks in advance!
The first step take all of column A and copy it to the 2nd sheet on column C.
Select data ribbon and select remove duplicates.
For column A insert vlookup for column C for all the data in 1st sheet
For column B insert vlookup for column B for all the data in 1st sheet
Those value will work well only if an ID has one valid Region and country.
Now just use custom sort to sort it in the way you desire.

Compare two columns and export unique values

Ok, I have a master list of customer names on sheet 3, column c. On sheet 1, column c, I type the names of the customers I have contacted. I want sheet 2, column c, to show a list of the names of customers that I haven't contacted yet. And I need it to update each time I type a name into sheet 1 that matches a name on sheet three.
The easiest way is with is to create a table on each sheet, sort it, then use IF, ISERROR and MATCH function to show duplicates. Here is a tutorial.
HTH,
M
Populate Sheet2 C1 and down with the following formula:
=IFERROR(IF(VLOOKUP(Sheet3!C1,Sheet1!C$1:C$10,1,0)=Sheet3!C1,""),Sheet3!C1).
As with user3654439's answer, which is good BTW, this will create a column that includes blanks which can be filtered out if desired. There is no need to make a table nor sort the data to get the formula to work. Also in the part of the formula Sheet1!C$1:C$10 the 10could be changed to match the length of the list of customers that you intend to contact.

Resources