I have a pivot table (in Excel 2010), looking like something like this (Countries in columns, sellers(included Factory) in rows and sum of totals in values :
**Country** **Factory ** **Seller A** **Seller B** **Seller C**
USA 30 31 19
GB 12 10
Denmark 14 16 20
What I need is to find a price difference between factory and store prices. I have tried "difference from" calculation with supplier name as a base field and Factory as a base item, but that is not what I really want. I.e it gives Seller A -Factory, but I would like to have Factory-Seller A, so the negative value would mean that buying from seller would mean, that I lose money, if I go buy from the Seller A. Additionally, I would like to have blanks (not difference) in the cases where the seller does not sell the item (where there is a blank in the data).
I.e the output would be
**Country** **Factory ** **Seller A** **Seller B** **Seller C**
USA 0 -1 11
GB 0 2
Denmark 0 -2 -6
It seems so easy, but I could not figure out how to write it as my own calculated field (or item? -however I can't add an item, get an error).
Can it even be done? I would think so as the "difference from" seems essentially the same thing, but as I don't know how that looks as a field formula, I can't replicate it. Hope its not too messy question, but I have tried to figure it out whole day. Maybe I am simply bad at googling things.
Related
After looking at a few similarish questions I figured I needed something more specific so asking here. I will start by explaining the situation:
The Setup
I have a Store which sells Cakes, Cookies and Wine. I have the weekly sales data of each product sorta like this:
Product ID
Product Name
Quantity
Value
Week Ending
1
Ginderbread
2
£4
13/01/22
2
Chocolate chip
5
£25
13/01/22
3
Red Wine Bottle
1
£10
13/01/22
4
Sponge Cake
3
£9
13/01/22
Currently every week's data is stored within the same table, with me using a Week filter to show only the week i'm interested in.
Using this Data I created PivotTables that shows the sales of each category, with the ability to drill down to show the specific products. Table looks something like this:
Category
Quantity
Value
Cakes
2
£4
Cookies
7
£29
Wine
1
£10
The issue
I now want to stick in a new calculated column that shows the Value as a %. E.g The total value for the previous table was £43, so Cookies is about 67%. If I drill down, it would show the Chocolate Chip record as 80% and Gingerbread as 20%
I imagine doing this would be easier if each individual week's data was on a different table, but I got a lot of weeks and I also want to do tables showing the sales for over a period of time. Plus I don't know of a way to merge the "value" and "quantity" columns, etc instead of having 1 for each week being shown.
any advice would be appreciated
Create an extra column in the source table (prior to filtering) entitled "perc" calculated as the corresponding value for each row divdied by the total value across all rows (se pic. / eqn. for first row below) --
=E2/$E$6
No calculated fields required - just include perc as the mesaure of interest in your pivot table, with value setting as 'sum':
The reason why this worked is because of the common denominator - which allows one to sum ratios on a 1:1 basis.
Devising a calculated field using the standard 'fields, items & sets' functionality for ordinary pivot tables would not be feasible / possible as far as I am aware. You would need to move into the realm of power pivots and data models - which is not too complicated (readily accesible directly from the field list per below) - however, I see this as unnecessary complication for the task at hand.
Side notes:
Using table names in your functions is sometimes more convenient when entering, albeit may appear tricky at first when reviewing - first eqn above becomes:
=[#Value]/Table1[[#Totals],[Value]]
So I have this issue, I have two tables one is employees, and another one is the projects.
Employees Table:
Year Name Type Jan Feb
2018 Kevin Salary 5000 2000
2018 Kevin Insurance 200 400
2018 Alex Salary 3000 4000
2018 Alex Insurance 300 400
Projects Table
Year Project_Name Employee_Name Jan_Hours_Worked Feb_Hours_Worked
2018 Apple Alex 7 5
2018 Apple Kevin 5 0
2018 LG Kevin 0 3
Now I am creating a result list of all the projects and costs recurred for them, what I need is for each project in Table 2 to find which employees are involved and then use that to find related costs for the employee from the Table 1 and calculate total costs for that project.
(e.g for project LG, I have Kevin working on that in Feb,for him company paid 4400(salary+insurance) in Feb and the costs recurred for the LG project would be 4400 divided by hours spent on the project which Kevin in total spent 3 hours; e.g.2 for the project Apple it would be the same but sum of Kevin's and Alex's costs from Jan and Feb, so Kevin: 5200/5 + Alex:3300/7 + 4400/5)
Now I have the formula to calculate this for 1 months which is something like this
=SUMPRODUCT(SUMIFS(Employees[Jan], Employees[Name],Project[Employee_Name], Employees[Year], 2018 )/Project[Jan_Hours_Worked],--(Project[Project_Name]=K14))
I need to find how to get the yearly result per project without repeating the formula 12 times, also with this formula, i get div to 0 error when an employee didn't work on particular months, so that needs to be sorted somehow. Any Help?
I suggest you to change how you store your data. If you can make some minor changes, then you can have an easy way to get the information you want, and also a Pivot Table with a summary of cost recurred for each proyect and which employee generated that cost.
IMPORTANT: For this answer to work, you must make sure that every Employee's Name is UNIQUE. If not, adapt the example trying to create
an Employee's ID or something.
Also, please, note i got a spanish version of Excel, so screenshots are in spanish but I will translate formulas :)
Ok, first of all, I changed the design of your table Employees. Creating a column for each month is kind of annoying. Use just a column to get the month. You can type the month in a cell just like 01/2018 and Excel will change it instantly to format mmm-yy (Jan-18)
This is how your Employees table should look:
The column TOTAL COST is just a sum of SALARY + INSURANCE. If you have any other concept, just add it as a column and modify the TOTAL COST COLUMN to include it.
Second, the table Project, I think it should be like this:
The column Employee Cost has an Array Formula.
IMPORTANT: Array formulas are inserted pressing CTRL+SHIFT+ENTER
The formula is (I used same names for tables, so copy-pasting should work for you):
=INDEX(Employees;MATCH(Project[[#This row];[Employee_Name]]&Project[[#This row];[Month]];Employees[Name]&Employees[Month];0);COLUMN(Employees[[#Headers];[TOTAL COST]]))
If you typed the formula right, you should see { at start and } at end.
The formula in Cost Recurred to Project is just a division of Employee Cost / Hours. Added an IFERROR when the hours worked are 0, then show 0.
=IFERROR(Project[[#This row];[Employee Cost]]/Project[[#This row];[Hours]];0)
And last step, your Pivot Table. Create one and organise it to get the sum per hours and month and proyect you want. You can get one like the one below:
As you can see,e.g. for project Apple, you can see that total cost is 2.391,43
but also you can see the cost of each Employee. Pretty cool I think.
I really hope you can modify the design of your data, because Excel is designed to work going down (I mean using rows) more than using columns. Excel 2007 got more than 1 million of rows and just around 16.000 columns, so it's designed to work vertically.
Hope this helps, or at least, give to you a clue of how to proceed :)
I'm currently working on an Excel program to manage employees at the checkout counters at a larger supermarket. It will load the employees' work schedules from an online database and then place the employees at the different counters.
Currently I'm at a point where I have loaded the schedules and divided the employees into the day shift and the evening shift in a sheet looking like this (only with much more people in reality):
A B C D E F
1 Name1 0745 1615 Name5 1515 2130
2 Name2 0830 1600 Name6 1600 2230
3 Name3 0915 1615 Name7 1630 2230
4 Name4 1000 1530
where 0745 is 7:45 and 1615 is 16:15 (4:15 PM)
Now, I would like to match a person from the day shift with a person from the evening shift so that ideally there will be a 15 minute overlap between all of them. As in the example above it is not necessarily given that there are equally as many people in the day and the evening shift, neither it will not necessarily be given that there can be an overlap of exactly 15 minutes between all teams of two. In this case, an overlap of 30 minutes is better than an overlap of 0 minutes for instance.
My own idea is to try all possible combinations of matches between the two data sets and then assign different error values to the different kinds of overlaps so for instance an overlap of 15 minutes yields a value of 0, 30 minutes yields 1, and 0 minutes yields 2, and then the best match is the one with the smallest total error.
However, I have no idea how to program this in VBA or if this is even the best approach.
I have tried searching the forum, but I didn't find anything helpful unfortunately. I hope one of you can help me or have an idea where I can search.
I think there's a lot of thinking behind the answer to your question. Writing the code for this is a bit of a project, in my opinion.
You could make your life a little easier by sorting columns A-C ascending by column C and sorting columns D-F ascending by column D. If you're not working with a lot of employees, your answers will kind of fall out of that. (In your sample data set, it becomes immediately clear that Name4 is paired with Name5 and Name1 or Name3 is paired with Name6.)
It's not a complete answer, but maybe it's a start.
I'm trying to create an average by category in a pivot table. This is the first time I've created a pivot table so sorry if the answer is staring me in the face. My raw data looks like:
Date, Transaction type, Description, Paid out, Paid in, Balance, Category
Mar-13, Visa, SHOP, £4.44, , £X, Gifts
Mar-13, Visa, SHOP, £5.00, , £Y, Children
Mar-13, Visa, SHOP, £6.00, , £Z, Gifts
Mar-13, Visa, CLOTHES SHOP YORK, £8.00, , £A, Clothing
Mar-13, Visa, FOOD SHOP, £11.96, , £B, Food
My pivot table shows the information rolled up by Month and grouped by a category:
Row Labels Sum of Paid out Sum of Paid in Sum of Difference
2013
Jan £Jan £Jan £C
Food 1 2 -
Car 2 3 -
Cash 6 6
Feb £Feb £Feb £D
Food 1 2
Car 8 0
Cash 2 3
The categories/data is made up in this case, but the desired outcome I'm after is to get an annual average, informing me how much comes in/out on average across the year per category... looking something like:
Row Labels Sum of Paid out Sum of Paid in Sum of Difference
2013
Avg £AvgIn £AvgOut £AvgDiff
Food 1 2 -
Car 5 1.5 -
Cash 4 4.5
Jan £Jan £Jan £C
Food 1 2 -
Car 2 3 -
Cash 6 6
Feb £Feb £Feb £D
Food 1 2
Car 8 0
Cash 2 3
Is this possible to achieve using a pivot table, as I can't seem to find a way to this at the moment using Excel 2010.
Since it appears that your raw data is already grouped by month, you're able to do this pretty easily. You need to re-arrange your data, however -- the months and the categories need to be on different axes. For example, Category as ColumnLabels, with Values then Month as Row Labels. Then right-click one of the normal values for Paid Out, choose "Summarize Value As...", you'll see SUM is currently checked, just change to AVERAGE. Repeat for one of the Paid In values. The labels should change to help let you know if it worked.
Note that this will NOT work effectively if your source data comes in daily, for example. With only one entry per month, the SUM and the AVERAGE of the single entry are identical. This would not be the case if your raw data was daily (and you still grouped by month) -- you'd be switching from a monthly total to a daily average.
I am currently using LibreOffice, which is just the free version of Excel on a mac. It is basically the same thing, but anyways, do you see the top bar where it says =AVERAGE(B8,C8,D8)? Well, that is how you can incorporate the functions within the table. This is actually a pivot table I had to do for my Java class. All you have to do is click on the cell you want to edit, type =, the function name, (in your case, AVERAGE should be fine) and then any other kinds of functions you use. Hope this helps you out.
This is driving me nuts.
I have a table of sales information based on dates as followed.
Date Price
1/1/12 5
2/1/12 5
12/1/12 5
Now i've used a pivot table firstly to group by week, then count the number of values for sales and tally up the Price as followed
Week Quantity Revenue
1/1/12 - 7/1/12 2 10
8/1/12 - 15/1/12 1 5
I have a 'quota' or desired quantity per week which is 3 and i'd like another column that subtracts 3 from the quantity to give me a difference like so.
Week Quantity Revenue Difference
1/1/12 - 7/1/12 2 10 -1
8/1/12 - 15/1/12 1 5 -2
I've tried adding a formula to do this but firstly i can't access the quantity column because its not a field and i can't work out the formula to make a field to replace the quantity column. Any ideas?
The only way I can figure to do it is to change the source data and add Quota and Quantity columns to it. The quota has to be calculated so that it adds up to the desired amount per week, in this case 3.
The formula for the quota calculation is:
=($F$2/7)/COUNTIF($A$2:$A$22,A2)
You can then make a calculated field, here shown as "Sum of Field 1":
This isn't a very manageable solution. And if you have multiple products and/or different quotas it will get uglier fast! But it's the best way I can see to do it with a pivot table.