Excel Pivot table count between - excel

I have a problem creating a pivot table/chart with between date function.
I would like to know the total count of projects that are active between two dates. A Chart with on the x-axis week 1 - week 52 is what i'm trying to create.
Example Chart
20
10
5
0
week 1 week 2 week 3 .....
My columns:
Project ID | START WEEK NUMBER| END WEEK NUMBER
What have I already done?
Adding helper columns 1 till 52 with the following function:
=IF(AH$1=MEDIAN($AB10;$AD10);1;IF(AH$1=$AB10;1;IF(AH$1=$AD10;1;"")))
This will show a 1 when the column week header is equal or between date start week and end week. But with this I am still not able to create a chart with the weeks on the x-axis and the total count of that week.

Make a new sheet and in Column A put your weeks 1-52 down. In column B use this formula:
=COUNTIFS(Sheet6!$B$2:$B$18,"<="&A2,Sheet6!$C$2:$C$18,">="&A2)
Sheet6! Needs to be replaced with the name of your Sheet, e.g. Projects!
Column B range needs to be the entire range of your start week
Column C range needs to be the entire range of your end week
B and C dimensions need to match.

If you need to use a pivot table, try rearranging your source data as shown:

Related

Excel - Create a pivot table by week that displays the weeks without dates with a null or 0 value

to keep it simple I have a spreadsheet that has dates that I need to create a pivot table with, grouped by week. The challenge is that I need to see the weeks that do not have dates. In the end I want to have a chart so there may be a way just through the chart.
Example Data:
1/3/2017 - 137
1/18/2017 - 10
1/19/2017 - 20
1/30/2017 - 45
1/31/2017 - 15
I would need something that showed the week. I will use the week number and sum the second column for the example above example.
Week - Data Total
1 - 137
2 - 0
3 - 30
4 - 0
5 - 60
I am not picky whether it is using MDX a formula, group, chart etc. The only thing that I do not want to do is add a date from all the missing weeks into the data.
If you create the Pivot Table using those two columns (dates as rows and numbers as values), then rightclick on the rows and select Group -> Days -> Number of Days 7, it'll divide all your dates into weeks and sum the values of each day. Want the weeknumbers? Add a column to the left of your Pivot Table and enter this formula:
=WEEKNUM(LEFT(B64;FIND(" ";B64 ) - 1 );2)
Substitute B64 for the cell of the Pivot Table containing the week range.
Here is what you can try:
The formula based on my setup:
=SUMPRODUCT(--(WEEKNUM($A$2:$A$6+0,2)=E2),$B$2:$B$6)
Try and let me know if this works or not.

Conditional Sum (based on current week)

I have an excel 2010 Workbook. Within this there are two columns.
The first column represents numerical week 1 (1-52 rows), the second contains a numeric value (never blank)
I would like a formula which basically sums all the rows (2nd column) up until the current week. So today it would sum the rows 1 through 11, next week it would sum 1 through 12
Tried a SUMIF but could not get it working (always zero)
Try this:
=SUMIF(A1:A52,"<="&WEEKNUM(TODAY(),2),B1:B52)
Where your week numbers run from A1:A52 and your values run from B1:B52.
You can also define which day the week begins on within the WEEKNUM() function by changing the second parameter. It is currently set to 2 which is based on the week beginning on Monday.

Indexing a sum of values by row from multiple columns

I'm struggling with this one...
http://postimg.org/image/50itqsz2x/
I've added a link to a screenshot, because I can't post images here...
In row 2 i have week numbers up to week 9 in this example. Row 1 has a formula that determines to which month a week belongs. In this example, week 5 is in month 1 and week 6 in month 2.
I need to sum the values by weeks and categories and show them in another table as monthly values as given in the example.
In B10 use this standard formula.
=SUMIFS(INDEX($B$3:$J$7,MATCH($A10,$A$3:$A$7, 0),),$B$1:$J$1,B$9)

Transfer data from one worksheet to the next based on cell values

I had trouble titling this, and I think it is better explained with examples. I am not an extremely experienced excel user, but was asked to figure this out.
Worksheet 1 (delivered by software) is formatted like this:
12/17/2013
Hour Delivered
00.00-00.59
Employee 1 18
Employee 2 17
Total For Hour 35
01.00-01.59
Employee 1 18
Employee 2 17
Employee 3 12
Total For Hour 47
... etc until hours 24.00-24.59
The number of employees in the group per hour is different each day, so i don't think that I can just simply reference the cells.
The worksheets that I want to transfer the data from worksheet 1 to are based on date, so there is one for each day. (12/17 worksheet, 12/18 worksheet, etc...)
And this is the format of the date worksheets:
Employee 00.00-00.59 | 01.00-01.59 | etc. until hours 24.00-24.59
Employee 1 18 18
Employee 2 17 17
Employee 3 12
Employee 4
Employee 5
So basically I need the data from worksheet 1 transferred over to the individual date worksheets. I believe, the amount of employees being different for each hour/day makes this difficult. Does anyone here have any ideas of how this can be accomplished?
Also, if there are any questions, please let me know.
This should be possible without any VB in two steps. First step is to add further columns to Worksheet 1 that normalise the data. Second step is to create a pivot table using that normalised data.
By "normalise" I mean add columns in Worksheet 1 for Date, Hour, Employee and Delivered using formulae that copy values from your existing columns A and B. Let me know if you need more help with that.
Edit: adding details ...
Suppose Worksheet 1 has the values you indicated in column A and B, and that you want Hour in column D. Suppose row 1 just contains column headings. Leave row 2 totally empty. The formula in col D needs to say "If the value in col A looks like an hour, then copy it, otherwise repeat the hour from the line above." A simple way to determine if a row in Worksheet 1 is an Hour is to look for a decimal point in position 3. So put =IF(MID(A3,3,1)=".",A3,D2) in cell D3 and copy that formula down.
I'm sure you can construct a similar formula for the Date, Employee and Delivered columns.
Maybe add a condition to the formulae to say "If the value in col A starts with 'Total' then leave the cell empty".
If there aren't a lot of data and the setup is exactly how you've displayed them above, a simple formula can solve this.
Assuming that my raw export is in sheet Base, cell A1 and my intended output starts in sheet Output, cell A1, you can use this formula on cell B2:
=IF(INDEX(Base!$A:$A,MATCH(B$1,Base!$A:$A,0)+ROW(1:1),0)=$A2,OFFSET(INDEX(Base!$A:$A,MATCH(B$1,Base!$A:$A,0)+ROW(1:1),0),0,1),0)
The premise is simple. It locates the correct hour using INDEX + MATCH, then OFFSETs it by the correct number of ROWs. This is assuming, of course, that your employees are in the same location under every hour (ie Employee 1 is always one (1) row below the hour, Employee 2 is always two (2) rows below, etc). We also add a check if the employee name matches so that it will return 0 if the employee is not there.
Here are some screencaps:
Sample data:
Output:
Of course, this is just the basic premise. If you have multiple dates in a sheet, it's just a matter of manipulating this formula further. Off the top of my head, locating the correct date and adding the correct offset can also work.
Let us know if this helps or if a VBA or the Pivot option seems best.

Is it possible to reference Cells via Cells in Microsoft Excel

In a spreadsheet i'm trying to fix up, on the final page i want it to gather totals, so far this is the structure
Month | Year | Month Start | Month End | Month Total
how this supposed to work is that the user enters the month and year then inputs the start and end rows (Month Start and End) of another page, this other page will contain records of transactions made with each transaction being a separate row, this can mean one month can have 5 transaction while another may have 50
i'm making the assumption that the user doesn't now how to reference data from another sheet so how i want to try and implement it so that they add the row numbers to Month Start and End and Month Total will generate the formula
eg.
Month Start = 4
Month End = 6
Formula Generated in Month Total = "=SUM(Transactions!E4:E6)"
if the user changes Month End to 9, the formula generated above will change the E6 part to E9, like i said above, each row in the Transactions sheet is a transaction and there can be variable number of transactions a month
what i am asking is if it is possible to references cells like this
Take a look at the INDIRECT function
You can use the OFFSET function to generate offsets from a starting point.
Assuming your layout is like this:
A B C D E
1 Year Month Start End Total
2 2012 Jan 4 9 =sum(...)
The total column (cell E2) could have the formula:
=SUM(OFFSET(Transactions!E1,C2-1,0,(D2-C2)+1))

Resources