Difference Between Quota and Sales Count in Pivot table - excel

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.

Related

Excel: Count distinct numerical values if string condition matches

I have a list of employee names on one tab and another tab with orders shipped by employees and the month they were shipped going back 12 months. I'd like to calculate the average number of products shipped per employee per month, but I need to know how many months they were here to do that. So what I'd like to do is essentially write a formula that says give me the count of the distinct number of months they've been shipping products.
Sample employee data:
And here's the sample data on the individual shipments:
So in short, I need to know that Joe Smith shipped those 250 products across 3 distinct months to see he averages 83.3 shipments per month. Again, because there are many new people who have come onboard in the last 12 months, I can't just divide them all by 12 and need to know how many months they were shipping items in.
FILTER Shipper and Month based on Shipper column with criteria Employee name. Apply UNIQUE on filtered array to get only unique values (name + month number). Use COUNT to get active months. Divide Products Shipped by it.
Result:
Average by Count of Uniques
=LET(Shippers,B2:B11,Months,C2:C11,uShippers,E2:E4,uProducts,F2:F4,
uMonths,BYROW(uShippers,LAMBDA(uShipper,
ROWS(UNIQUE(FILTER(Months,Shippers=uShipper))))),
IFERROR(uProducts/uMonths,""))
You can use this array version, which spills all the results at once:
=LET(empl, A2:A4, prods, B2:B4, shipper, B7:B16, months, C7:C16,
ux, MAP(empl, LAMBDA(e, COUNT(UNIQUE(FILTER(months, shipper=e))))), prods/ux)
Here is the output:
It is also possible not using MAP but it is a verbose solution:
=LET(empl, A2:A4, prods, B2:B4, shipper, B7:B16, months, C7:C16,
left, TRANSPOSE(N(shipper=TOROW(empl))), right, N(months=TOROW(UNIQUE(months))),
cnts, N(MMULT(left, right)>0), ux, MMULT(cnts, SEQUENCE(ROWS(cnts),,1,0)), prods/ux)
Replacing TOROW with TRANSPOSE it should work for older Excel versions.
This is how I would have done it, create a Pivot table(Insert->Pivot Table) with Months as column, Employee as row and the values as count of shipments. Once you have the Pivot table, your life becomes easier. Now you do a count of the employee row (COUNT(COL-1:COL-X)) to count the total months a particular employee showed up.You now have count of shipments and a count of months. You can calculate the average. Not sure I can think of anything else easier.

Excel - Count the number of instances of order status

I have the above sales order data which lists a day by day update of orders as they go through each stage until shipped. Orders 1 and 2 are shown alongside the status of that order for each date between 1st and 08th February.
What I need to do (in a pivot eventually), is to count the number of days for each order that they were in each state. So for example Sales number 1 was in a processing state for 4 days and a packed state for 3 days and then finally a shipped state for 1 day. I want these 3 numbers displayed beside each status maybe on a separate line?
For example
Sales Number 1
Processing - 4 Days
Packed - 3 Days
Shipped - 1 Day
You'll also notice that on Sales Number 2, the order went back into a "On Hold" state, this can occur in my dataset so just count it as normal e.g On Hold - 2 days.
How would I get this count using a formula or pivot etc?
Simplest way is to use pivot table:

How to calculate average of parent category in excel?

I have data in below format. It shows starting and end time of an activity and calculates duration accordingly. The activity is performed through out the day at different times.
I have added a pivot. I want to find out the average duration in a workday or a holiday(Day category). When I am trying to apply average in the current pivot, it is dividing the total duration by the number of sessions in a day.For example in week 1, an activity was done on 4 work days and the total duration for the activity in workdays was 04.19, I want to divide this number by 4 and find out the average time spent on each day but the pivot divides it by 11 which is the total number of sessions in the four days.
Link for data
Steps:
Add a helper column to identify how many unique pairs of Dates/Day Categories there are:
=IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))>1,0,1)
You can add extra products to this formula to force extra fields to be unique to be counted as well.
SRC:Simple Pivot Table to Count Unique Values
Add a Calculated Field in the PivotTable that is:
SUM(Duration)/SUM([Helper Column Name]) and include it in the 'Values' section of the PivotTable. Due to the new column being added, you might have to re-create the PivotTable.
This should produce the average in the manner that you want.

Calculate the average sale for each month in excel 2013 pivot table

I have a large chunk of sales data with (some columns removed for clarity purposes):
Order Id, Order Date, Product, Amount, Product Price, Row total cost, Order total cost
A specific order can, as you may see, be divided over multiple rows - were order id, order date and order total is the same on each row. The "row total cost" contains the price for a specific amount of a specific product in the order.
It's not the best way to store data - I know...
Any ways. What I would like to do is to calculate the average sales value for each month. For example - total sales in sep 2012 is $1000, and in sep 2013 it's $500. The average sale for september would be 1000 + 500 / 2 = $750.
This I would like to present in a pivot table and pivot chart.
What I'm stuck with is an average sales value compared to the grand total (sep 2013 compared with all month of 2013 and 2012). I believe I need to group or filter my average calculation - but can't figure out how to do that.
Any help is much appreciated. Using Excel 2013.
Is the challenge caused by the "Order Total Cost" column containing repeats, and hence when you get average of that column it is not accurate?
If I assume that the columns you list are headings in row 1 and that data starts in row 2, then add a column headed Real order total with the formula =if(A2=A1,"",G2) in cell H2. Copy that down and it will give the order total just once for each order. Then base your average or pivot table on col H rather than G.

Excel Pivot Table - Averaging by Category

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.

Resources