Add entire calender year to pivotTable in Excel from sample with only few dated entries - excel

Hopefully somebody can help me figure out a better way to create what I need in a pivotTable. I have a table structured as follows:
Date | ID# | Revenue
---------------------------------------
1/1/14 | 123 | $200.00
1/1/14 | 234 | $99.00
1/5/14 | 455 | $100.00
1/31/14 | 5666 | $50.00
2/4/14 | 2454 | $500.00
...
...
...
12/4/14 | 88484 | $3000.00
Unfortunately, when I create a pivotTable off of this information, and then try to process the data all the way into chart data, it gives me only dated entries when there is an actual entry.
What I need is to not only create a table that shows dates that had $0.00 revenue, but also a chart that displays all 365 days, without manually going back day by day (as there are 1000+ rows) to enter a day that has a $0.00 revenue.
Any ideas?

One approach would be to put the days of the year into a spare column, say D, by starting with 1/1/14 in D2, pulling down with the right mouse button and choosing 'Fill Days'.
Then put a formula into column E starting in E2 like
=SUMIF(A:A,D2,C:C)
to put in the total revenue for each day in column C based on all matching days in column A.
that's assuming that what you want is the total revenue for each day of the year whether or not it's zero.

Related

Calculating part time and full time employees

I have three columns in Excel 2010:
Name
Activity
Person_Days
a pattern looks like this:
John | Activity_A | 2
John | Activity_B | 10
John | Activity_C | 5
Mary | Activity_A | 2
Mary | Activity_D | 12
...
I want to make an extra column that tells me if a person is working 1-30% of the time, 30-60% of the time or 60-100% of the time. Maximum number of person days is 18.
How can I make a formula in Excel which calcultes that?
How about try the SUMIF formula?
=SUMIF(A1:A5, "John", C1:C5)
The above would check cells in A1 to A5 for the value "John" and sum the contents of C1 to C5 where the A column value is "John".
Take that and work out your percentage using your 18 person days. Then just throw in some conditional formatting to show colours for your percentage breaks.
Above would need tweaked to give you exactly what you want but the core idea should work.
SF

How to select/filter rows in MS Excel based on cell value

I'm working on an excel sheet which has a simple structure like this.
Date | Order
-----------------------
08-15-2014 | 84
08-16-2014 | 50
08-17-2014 | 68
08-17-2014 | 78
08-18-2014 | 23
Here, in a separate column I'd like to calculate the sum of Orders by week days(Sunday, Monday and so on). Meaning, I want to see how many Orders received on Sunday, Monday etc.
So far I have come up with this non working formula.
=SUM(LOOKUP(1, WEEKDAY(date_column), order_column))
This was example for summing all order received on Sunday. And, yes Date column is in DateTime Data type so that shouldn't be a problem.
Thanks.
Consider adding a new column after the dates, representing the day values. So in column B you might have something like =TEXT(WEEKDAY(A2),"ddd").
Then if you wanted to sum up order numbers by day, you could use an equation like =SUMIF(B1:B5,"Sun",C1:C5) where column B has the day values and column C has the order numbers.
To show an example (with headers, etc):

Transponse just some columns in excel

I have a worksheet with columns similar to the below
name | id | contact | category | week 1 | week 2 | week 3 | ... |week 52
What I need to do is transpose the 'week' columns into rows, so I end up with:
name | id | contact | category | week
With an entry for each week as a row in the s/sheet - thus making a long list on rows with the column data for each week.
example current format:
jones | 12345 | simon | electronics | 100 | 120| 130| 110 | ..........150
Required format
jones | 12345 | simon | electronics | 100
jones | 12345 | simon | electronics | 120
jones | 12345 | simon | electronics | 130
jones | 12345 | simon | electronics | 110
...
jones | 12345 | simon | electronics | 150
I have tried the usual excel transpose (via paste) but cannot get the first few columns to stay static, whilst transposing the week columns
Ideally I would like to achieve this within excel, but I can import the data into a mysql database and use that if the solution would be easier that way
Hope this makes sense
[added examples]
I would do the work on a second sheet, which uses the INDIRECT function to do the lookups for you:
http://www.excelfunctions.net/Excel-Indirect-Function.html
Start by setting up some indexes on the new sheet - we will use these to indirectly look up into the original sheet and pull the data across.
I would count up to 52 again and again in column A, starting with a 1 in A2, and using this formula below:
=if(A2=52,1,A2+1)
This would be my count of the weeks per person.
In column B, I would count my people, starting with a 1 in B2, and using this formula:
=if(A3=1,B2+1,B2)
This gives me the row and column offsets to use in the INDIRECT function to fetch the data from your original sheet.
Now the fun part - matching these row and column offsets to your actual data.
Lets assume your original data is in a sheet called "original". This is where we need to look up the data.
We will map the original column A into the new sheet's column C. So C2 can hold this formula:
=indirect("original!R"&($B2+1)&"C1",false)
What you are doing there is looking in the row that you calculated in the B column (formula above), and looking in the first column of that row (i.e. column A) - this is where the Name is stored.
Similarly, the "id", "contact" and "category" columns get mapped to new sheet columns D, E, F, using modifications of that formula:
=indirect("original!R"&($B2+1)&"C2",false)
=indirect("original!R"&($B2+1)&"C3",false)
=indirect("original!R"&($B2+1)&"C4",false)
Only the column offset gets changed in these updates.
To pull the weekly data across, we use a similar formula; the difference is that now we get to use the newly calculated column A, where we counted up from 1 to 52 over and over.
So G2 becomes:
=indirect("original!R"&($B2+1)&"C"&(4+$A2),false)
Copy this all down as far as you need, and hide columns A and B.

How to autosort a column in Excel when editing a table

I have want to make a sports system so that people can bet each weeks on a few games. So:
Name | week 1 | week2 | ... | week 32 | Total
I want every time when I insert some value in the week columns that total table gets sorted.
Can somebody help me with this?

Custom Formula for Grand Total column

I have a frequent problem where the formula I want to use in the Values area in my Pivot-Table is different than the formula I want to use for the Grand Total column of that row. I typically want to Sum the Values but I want to average the Sums. Here is what I normally would get if I pivoted the dates on the Column Labels, Meat Type on the Row Labels, and Sum Orders in the Values.
Row Lables | Day 1 | Day 2 | Day 3 | Grand Total
________________________________________________
Beef | 100 | 105 | 102 | 307
Chicken | 200 | 201 | 202 | 603
I get sums by day and a sum of all of the days in the Grand Total column. Here is what I want to have:
Row Lables | Day 1 | Day 2 | Day 3 | Grand Total (Avg of Day Totals)
________________________________________________
Beef | 100 | 105 | 102 | 102.3
Chicken | 200 | 201 | 202 | 201.0
In this case the Orders are still summed by day but the Grand Total is now an average of the sums. What I do now is copy and paste the Pivot data onto a seperate sheet then calculate the averages. If there was a way to do this with a custom Grand Total column it would be incredible. This is one of the biggest shortcomings of Pivot Tables for me but I'm hoping it is due to my ignorance, which it often is. Thanks for the help!
You can write a measure that checks the number of 'rows' in a particular filter context and nest that in an IF() to determine which to use.
If using PowerPivot V2 then it's:
=IF(HASONEVALUE(Calendar[Day]), SUM(AMOUNT), AVERAGE(AMOUNT))
If using PowerPivot V1 it's:
=IF(COUNTROWS(Calendar[Day])=1, SUM(AMOUNT), AVERAGE(AMOUNT))
Both do the same thing in that they assess the number of rows in the table in the given context and when the Meat Type is 'Beef' then the temporarily filtered table has one row. If it doesn't have one row then its going down the path of the AVERAGE()
This assumes your column headers 'Days' are in a table called Calendar (if you aren't using a separate Calendar table then you are missing the most powerful functionality of PowerPivot IMO).
Jacob
I can't think of a "good" way, but here's one option. Add the Amount field to the data area a second time and change the operation to Average. Then use conditional formatting to hide the averages in the data area and hide the sums in the total area.
You might be better off just using some array formulas in a do-it-yourelf pivot table. You lose the pivot table benefits, but get more flexibility with the data.

Resources