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.
Related
The point of this exercise is to try to make this analysis quicker/easier to update. I had it pretty dialed in using a data tab and a pivot table, copying and pasting values/formulas as needed to update. I am trying to improve on that by using Excel's new Dynamic Arrays.
My table is setup with four employee detail columns (Location Name, Location Number, Employee Name, Employee Number), and several (many) columns for dates worked. My issue is the dates worked.
I am using UNIQUE and FILTER to get a list of flagged employees - works as I intended/hoped; lookup formulas to find the location name and number data for each employee from the data table - works as I intended/hoped; and I have been copying/pasting the dates from the pivot table column headers into my "counting"/analysis table header.
What I would like to do is use the UNIQUE formula to get the dates worked - BUT, I want the spill area to go along the row so the dates are column headers. Okay, I probably could have made that a shorter ask, but I hope explaining a little of what I'm trying to do helps. I want the dates to automatically update when I paste new payroll/hours worked data into the data table, the same way the employee data updates.
The key is to TRANSPOSE the UNIQUE formula, not the data:
=TRANSPOSE(UNIQUE(A1:A9))
I cannot find anything about having the spill area go along a row instead of down a column. My workaround for this was to create a column of unique dates next to my data table. Since the data is in a table, the unique dates will update automatically when the table is updated. I used the Offset formula to pull the dates into my column headers from the column of Unique dates next to my data table. I will say, while this setup is easier than updating via the pivot table, it is a formula heavy workbook now.
For the data headers I used : "=OFFSET('Data Table Tab'!$U1,Column()-5,0)". The "rows to offset" portion of the formula is "Column()-5". My first date header is in column 5, so as it is copied to the right this will increment the number of rows to offset from the first date.
At this point I will just need to copy the formulas over to the right to update my analysis table.
I would be surprised if someone else out there just starting to work with the new Dynamic Array formulas in Excel doesn't wonder about the same thing. If you stumble across this question and have a better solution, please feel free to share it with me.
Lets say I have the following on a sheet.
By some means, I want to either replace this, or preferably, create a new sheet, with the following data. Notice, that PO# is out of the picture, and a summation is done on rest of the fields. Is there a way to easily do this?
The end result has to be data in excel grid like below (preferably on a new sheet). This can possibly be some macro or some other technique I can use to easily create this....
You can easily do this with SUMIFS() or a Pivot Table.
For SUMIFS() the below equation will give you the sum for W.PS123 Product A. Modify as needed for your other criteria by swapping AR and product number (both housed in quotes in below formula, you can also set these equal to a cell range that contains desired criteria).
If you have a set number of "ARs" and Product Numbers, you will only need to build this table once and the equations will automatically update as your raw data changes.
=SUMIFS(C:C,A:A,"W.PS123",E:E,"A")
Alternatively, you can build a pivot table and just refresh this every time your data updates (or create a worksheet_change macro to refresh the table automatically when your data changes).
To build your pivot:
Highlight your table array (In your example, Col A-D)
Insert > Pivot Table
Drag AR to Rows
Drag PRODUCT to Rows (Below AR)
Drag QTY to "Values" and change the field to "Sum" rather the default count
Format to taste
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.
-
I have a tabular data with values as in picture. I created a pivot table in excel 2007 .How can I get count value of each up/Down for date specified. I tried to by making one column row and other as values but it would not work.
The result would be:
A better solution is to use a countif function on a second tab. something like
=COUNTIF(Sheet1!A:A,"UP")
and
=COUNTIF(Sheet1!A:A,"DOWN")
and copy it across the range of dates.
If you can format your data differently to look like this
Then the pivot table becomes easy withthe following settings
How can I transform data in excel in this form (see image here: http://imgur.com/PgX5r) into something suitable for using in a pivot chart. I need three columns eventually, Date, Country and Score. The amount of data points for each country is not constant.
The easiest way i found without using VBA is to use an array formula :
Add another column on the left of your values (let say Col A)
Set this formula on cell A1: {=INDEX(B:B,MAX(IF(ISEMPTY($C$1:C1),ROW($C$1:C1),ROW($C$1))))}
Validate with CtrlShiftEnter
Drag the formula till the end of your values
Your data are almost suitable for a Pivot Chart. What you can do next is to delete unneeded rows (with country names and headers) or use another formula on another sheet to "duplicate" the data except when unwanted rows (you can then filter the blank data in the pivot chart).