Sum employees based on mapping in another table - excel-formula

I have one dynamic named range where I have the employees and their opportunities listed. the table also has a subtotal by employee. I have another table where I have a list of teams and the employees on those teams. The two tables are not the same size.
How do I sum up the employee totals from table 1 if they belong on the same team? In other words, how do I get the team total?
There is a similar question with an answer but when I try to use the sumif based on that answer, i am getting a #value error as the criteria range is not the same size.
Thanks

Related

Function to filter excel table data in to a new dataset based on value defined in another table

I have two tables of data, the first is EmployeeSalaryTbl which holds the salaries for employees over time:
and the second StaffDetailsTbl which has details on the employee discipline etc.
I use various columns from the tables in a function to calculate total employee salaries per month and I'd like to re-purpose the function to only calculate the salaries dependent on a specified discipline in a given cell, for example Progamming.
To do this, I was thinking, is it possible to filter the results of EmployeeSalaryTbl[Employee], EmployeeSalaryTbl[Salary Start Date], EmployeeSalaryTbl[Salary End Date] etc to only contain the rows where the employee has the Programming discipline through a lookup in to the StaffDetailsTbl?
If it doesnt need to be pretty and you just want to sum the totals
You could put this in the column next to your table, starting at the first row you want to check from. then at the bottom sum up the values. You can change where it says programming to make it a cell reference if you want to check for various disciplines
=IF(INDEX(StaffDetailsTbl[Discipline],MATCH(EmployeeSalaryTbl[[#This Row],[Employee]],StaffDetailsTbl[Employee],0))="programming",EmployeeSalaryTbl[[#This Row],[Salary]],"")

Excel - Pivot Slicer or Via VBA?

I am posting this to all Excel Champs and Code Experts. I am familiar with Pivot and Slicer feature of excel however came with an requirement and I could not think of any way I can achieve it via pivot ( preferably )
The Requirement is like this. I have team data in col 1 and Sales figures in col 2. Now with a simple pivot, I can have the team totals and things like that but I need to put in slicer on team name. If I select Team one , it should show Team one sales against total of other three team . PLease advice if there is a way to do that. In summary I need to compare a person's /team performance against total peers
Team Sales
One 20000
Two 15000
Three 500
Four 35000
One 500
You can achieve this with formula next to your PivotTable values. You will use formula against your total range of values in col2. If your columns are set to range A:B, and PivotTable is in range D:E, then put this formula =E2/(SUM($B$2:$B$30)-SUMIF($A$2:$A$30,D2,$B$2:$B$30)) in cell F2. You should get result as follows.
If you need to have result inside your PivotTable, then you should use PowerPivot and create a measure. try looking at this for more info: https://msdn.microsoft.com/en-us/library/gg399161(v=sql.110).aspx

Two comparisons with Excel countif function

I have an issue with using countifs function. Basically, I have to compare to columns and count frequency of repeating.
My tables are like:
Product ID: NAME OF PRODUCT, TOTAL PIECES OF PRODUCT, QUANTITY OF PRODUCT. I would like to compare name of products and total pieces with quantity of product is it equal and count how many rows are with those two conditions.
Thank you for answer
I think you want a pivot table.

VLOOKUP + PIVOT TABLE DATA

OBJECTIVE
Given a group of Clients, group each client into "discount" buckets based off of annual sales.
SETUP
Pivot Table with Customer Name, Annual Sales
Table with pricing categories (Bronze, Silver, Gold)
APPROACH
VLOOKUP(ANNUAL SALES, PRICING[ALL],2) - if a client exceeds a certain threshold in the PRICING table, they'll be listed as the corresponding PRICING bucket (e.g "GOLD").
ISSUES/QUESTIONS
VLOOKUP doesn't work well with pivot tables, especially if I collapse parent categories in excel. Is there a way to create a calculation field (that works with the pivot table, regardless whether or not parent categories are collapsed/hidden) that will essentially perform a VLOOKUP on a pricing table?
There is the function GetPivotData which is very powerful to use.
Have a look at this: GetPivotData formula (Contextures)
Bear in mind that the structure of the PivotTable needs to be stable, else you may get unexpected results.
You can also use INDEX / MATCH to get data from PivotTables, advantage of index/match is that you can use the row data as well as the value fields (whereas GetPivotData is limited to value fields).
SOLUTION
By using VLOOKUP and SUMIFS, I was able to develop a formula that would:
Create Pricing Categories
Categorize Customer purchases based off of three attributes (e.g
customer, Product, Configuation) and sum revenue
Categorize Pricing Tier based on total revenue spent
FORMULA
=VLOOKUP(SUMIFS(Sales Revenue, Client ID, Product, Configuration),PRICING TABLE, PRICING TIER, TRUE)
The Formula sums all Sales revenues that match the Client's ID, Product, and the Product's configuration (e.g Total Revenue per Client, per Product). The VLOOKUP formula uses this value and compares against a pricing table.

Count/If/Sum formula

I am using a spreadsheet to count sold items for several teams.
Rows: Individual Seller
In column A I have the specific team the seller belongs to.
In column B I have the amount of items that the seller sold.
In a separate row at the end of the document, I am trying to calculate the total number of items being sold from a specific group.
Can anyone help me write the code needed to return the total number of items sold for each specific team?
The image shows some sample data in A1:C13, and three different ways to sum the amounts by teams. There are many others ways. Of the three I recommend #Jerry’s suggestion of a PivotTable (E2:F6) because it is very easy to set up, very quick in operation and offers a great deal of versatility beyond merely summing amounts by team. For example if your data included dates of sales it could sort and group by week, month, year etc. The second version of it (E8:F14) shows a breakdown by Seller of the 20 total, but by the number of ‘sales’ (rows) rather than number of items sold.
The formula in D20 (copied down to D22) is:
=SUMIFS(B$2:B$19,A$2:A$19,A20)
However SUMIFS was not available as a standard MS Office function before Excel 2007, though SUMIF was, so in B20, also copied down to suit:
=SUMIF(A$2:A$19,A20,B$2:B$19)
SUMIFS allows more conditions than SUMIF, so for example can be changed in D20 to:
=SUMIFS(B$2:B$19,A$2:A$19,A20,C$2:C$19,"Seller1")
to obtain the amount of items comprising the two distinct ‘sales’ by Seller1 as shown by 2 in the lower PivotTable.
Since you are trying to calculate the total from a specific group the above may be more elaborate than your immediate requirement so a version that can be placed almost anywhere in your sheet (if as the example) and even copied around, replaces a variable with a fixed condition, which I have chosen to be teamB:
=SUMIF($A$2:$A$19,"teamB",$B$2:B$19)
and provided the formula is kept out of ColumnA might be further simplified by extending it to consider entire columns:
=SUMIF(A:A,"teamB",B:B)

Resources