Summarise data based on date - excel

I have a set of data in excel that looks like this:
Project Name alpha date alpha price beta date beta price final date final price
Project a 1/01/2013 $123.00 2/02/2013 $324.00 5/02/2013 $222.00
Project b 2/01/2013 $432.00 9/03/2013 $111.00 30/03/2013 $321.00
project c 2/02/2013 $4,431.00 8/03/2013 $231.00 7/04/2013 $343.00
project d 3/04/2013 $1,232.00 30/01/1906 $3,122.00 6/07/2013 $666.00
I need to generate a sum for each month/year across all projects and phases of the project. IE:
Jan 2013 $555
Feb 2013 $4,977
What's the best way of going about this?

This is a good use case for pivot tables.
Highlight the date columns, right click, Format Cells.. menu item. Then use a Custom Data format of MM/YY to get everything in month and year format.
Once all the dates are converted, highlight the entire table then make a Pivot Table of the data (use Create Menu). Place pivot table on new sheet.
Use the pivot table to group and sum data as needed. You can drag the various projects into pivot table rows, and then combine cost columns using the sum() function. Add filters or project groups where needed.
If you've never used pivot tables, I highly recommend taking 30 minutes to learn. They are very intuitive and powerful.
Good luck!

A suggestion is to ‘reverse pivot’ (eg as described An excel formula to find a row/column index in array) and double click on the intersect of the Grand Totals. Insert a column with:
=MONTH(Table1[[#This Row],[Value]])&" | "&YEAR(Table1[[#This Row],[Value]])
and a column with, in the first row below the headers (assumed to be Row1): =C3 where C is assumed to be the Value column.
Copy the Table and Paste Special Values.
Filter the Column column and delete all rows containing price.
Sort the month/year column and Subtotal, for each change in that column, the other added column.

Related

How do I filter a pivot table for MTD, QTD, and YTD?

I have a column full of specific date and time information, but I want use that data to filter my table to show only MTD, QTD, and YTD rows.
I can't upload an image of my table because of my work computer program, but I have the variable with the dates in the "report filter" field. The data in the column is given as an individual date and time, so that's all I can select when I try to filter it. There's too many option, and I need to be able to select simply QTD, MTD, or YTD dates. How can I do this? Apologies for the lack of imagery.
Select any part of the Pivot table
Under the Analyze tab of the ribbon select Insert Slicer or Insert Timeline whichever you prefer
Filter the dataset based on the criteria you want.
This won't give you your select columns, but without seeing the way you're data is structured should be a good fix.
If you have the issue where the dates won't summarize by month you can create two new columns to summarize the data and create a table with the following columns:
Month # / Month Name
1 January 'you can use whatever naming convention you prefer (jan, etc.)
2 February
....
Then you want to use the MONTH function combined with a VLOOKUP. It should look like =vlookup(month( [date cell reference]), [table you just made], 2, 0) This will pull the month name. Then you can use the YEAR function to get the years. Then make sure the pivot table accounts to the adjusted range and pull those in instead of date. You can still use the slicer and timeline to filter out the dates, but it will be summarized based on these new labels.

Excel - to format the data in a more readable way

Is it possible to get the above table in a format such as the table below, in a much easier manner without having to do a brute force approach of creating 9 columns for the LTV band and assigning it a PD value in the table?
Excel... Insert Pivot table
Select range and fill in as layed out in image below.
you can hide grand totals if you want by right clicking on the pivot table and selecting Pivot table options then the totals & filters
There are many other features as well but this gives you the general idea.
As to missing LTV values, you just need blank rows for each value so the chart pivots on all the data.
OK, Here's an idea
You can do what you want using a complicated index formula that checks the Year and the Month and other number but it's quite complicated, so.
Use a formula to create an ID column to the left of your data and you can use a fairly simple vlookup to extract the data.
The ID will be the YEAR + MONTH + B + I.TV number. On my sheet the formula is.
=C2&D2&"B"&E2
Next create your new table by listing the Years and Months and entering in the headings B1 to B9. Then put your vlookup in the first cell under B1.
=iferror(vlookup($A12&$B12&C$11,$B$2:$F$9,5,false),"")
It's not too complicated, $A12&$B12&C$11 builds the ID we want to search for using the Year, Month and Heading B1 cells. Pay attention to the way the cell references are locked as that allows you to autofill across and down while still referencing the headings etc. $B$2:$F$9 is the range you want to use for the vlookup and 5 is the column with the data you want to return.
Have a look at my example below.

Excel: transpose rows to columns and merge

I would like to present some data in Excel in a table. I have a sheet with three columns: date, time_spent and user_id. Every row is a data record. I want a table with a column for every date and every value with time spent below the date.
Using the transpose function under paste special I get this:
However I would like only one column per unique date, so the amount of columns decrease like this:
Does someone know how to do this?\
I have more than 10000 rows, so manually is too much effort...
Using Pivot Tables as Tim Biegeleisen suggested I cannot get what I want either, I'm not an expierenced user of Pivot Tables so probably I'm doing something wrong:
Excel file as shown in above picture
Here is one way of using a Pivot Table as suggested by Tim above in the comments, but you must use it on your original, non-transposed data: (and note which parameters go to which areas.
A disadvantage of the Pivot table is that the column headers are text strings and not dates. If your version of Excel is 2010+, you can use Power Pivot or Get and Transform to do a better job:
Open the Query Editor, change the format of the Date column, and Pivot the column:
Then Save the results:
Advanced filter dates to unique values in a new column
Copy and transpose them to make your column titles
Insert a new column B with the formula =TEXT(A2,"yyyyddmmm")&COUNTIF($A$2:A2,A2) and fill down
Below your new column headers put in the formula =IFERROR(VLOOKUP(TEXT(H$1,"yyyyddmmm")&ROW()-1,$B$2:$C$8,2,FALSE),"") and fill down and across. You will need to fill it down to cover the maximum number of instances of each date.
Adding a sumif to this table and your initial table would be a good way to check you got everything.

formula to calculate variance on a single pivot table column

Is it possible when pivoting a series of data to calculate the difference between 2 columns when 1 column is your column filter? for example, I'm trying to compare 2 accounts receivable reports a week apart, so I inserted a manual column in both reports called "week" and then, before pivoting, I consolidated the 2 reports. Now I have 1 column called "week" with 2 different values. When I pivot, I want to put the "week" column in the Column Filter and I want to put the outstanding balance in values, and I then I need to calculate the difference between the weeks. I can't seem to find a way to do this.
Thanks,
Assuming you are using MS Excel ...
From your description, I believe you have a raw data table that looks like this ...
... and a PivotTable that looks like this ...
If you were looking to calculate the difference between Account1 and Account2 on a weekly basis, this would be straight forward, using a calculated field. However, in order to calculate the change in Account 1 week over week, and the change in Account 2 week over week, you will need to go back to the raw data table and perform the calculation there, in new columns.
In the raw data, Column A is Week, Column B is Account1, and Column C is Account2 ...
Make header in Column D Acc1WkChng and the header in Column E Acc2WkChng
The first row of each of these columns is 0. The second row of Acc1WkChng is =B3-B2. The second row of Acc2WkChng is =C3-C2
The raw data table now looks like this ...
On the PivotTable, pick the PivotTable Tools -> Analyze Ribbon. Choose Change Data Source and increase the selected range to include Columns D and E.
Add Acc1WkChng and Acc2WkChng to the Values area. Format accordingly.
The PivotTable now looks like this ...
Note: This pivot table is merely a transpose of the original data. Presumably, you want to do something more interesting with it.

How can I create a % variance column in Excel 2010 pivot table?

I have a Pivot table containing sales data.
In the Rows I have sales country, in the Columns I have sales date (year) and I have the sum of the invoiced net values in the data section.
Across the top I have two columns - '2012' and '2013' - next to these excel, by default adds a grand total column adding the two years together.
Is there anyway that, instead of a grand total, I can show the percentage variance between 2012 and 2013?
Excel 2010 may be different but if Excel 2007 is better than nothing:
Create your PT in the normal way (Country for Row Labels, Year for Column Labels, Sum of Invoiced for Σ Values).
If present, remove the Grand Totals for rows (Select the PT, Pivot Table Options…, Totals & Filters, uncheck Show grand totals for rows). The Grand Totals for columns may be kept, but the value there in a column to be added would not be meaningful.
Select a column header (say 2013) and in Options > Tools – Formulas select Calculated Item…
In Name: select something suitable (perhaps ΔYonY) and for Formula: enter =('2013' -'2012' )/'2012'.
Set font colour of bottom right-hand cell to match fill.
pnuts' answer is accurate.
If you are looking for a way to have this calculated automatically in the PivotTable, you can use calculated fields.
In order for this option to work, you will likely have to change the way your data is structured.
I'm assuming right now you have a data column with Sales Date. You will need to add one column per year, and assign a value to it in your data. You can then get rid of your invoice column.
Click anywhere inside your pivot table, in the ribbon go to Fields Items & Sets, Calculated field.
In the formula, type in what you need (you can use the fields list to add them in). I did =('2013'-'2012')/'2012'
You can then of course change the formatting to be in %
See screenshot for old vs proposed.

Resources