Excel using pivot table count in another formula - excel

Anybody has an idea why i cant use pivot table count value that is a number for a calculated field in that same pivot table?
Here is the picture of what i mean:
Count field in the pivot table counts how many of the certain Models are in a table and i would need to use the following formula: Count divided by Sum of IN in this pivot table.
Every time i try to use the value from "Count" column it returns the #VALUE.

It might be a formatting issue where excel is not understanding that one of the numbers is a number. There are a couple of ways to address the issue.
Highlight the cells, Home>Number, then apply the number format.
Select the pivot table,
in the pivot table fields box, select the dropdown arrow in the values section and select Value Field Settings
Then select Number Format and then choose the desired formatting (likely Number)
Force it as a value in your formula.
I assume your formula looks something like
=D4/C4 or
=GETPIVOTDATA("Sum of Sum",$A$3,"Top","Top","Name","Bottom
")/GETPIVOTDATA("Count of Count",$A$3,"Top","Top","Name","Bottom ")
you can use the VALUE() function to create
=VALUE(D4)/VALUE(C4) or
=VALUE(GETPIVOTDATA("Sum of Sum",$A$3,"Top","Top","Name","Bottom
"))/VALUE(GETPIVOTDATA("Count of
Count",$A$3,"Top","Top","Name","Bottom "))
Create a new 'Calculated Field' in your pivot table that does the function for you.
Select the pivot table, then Analyze>Calculations>Fields Items & Sets>Calculated Field
Give your field a name, then for your formula, enter something along the lines of Count/Sum of IN. Use the Fields box to make sure you get the Field names right
Hopefully one of these options will help you get what you need.

Related

Filter column for substring and return max of adjacent cells -- Excel 2013 (no macros)

I would like to obtain the max call time that was on each day, the average of all the calls that day, and any calls that exceeded 20 seconds.
Due to the security policies at work I am limited to the formulas provided by excel, I can't use macros or VB (otherwise I would just write something suitable). I don't have much experience with excel, so I apologize if this is a simple one. I have tried to find ways to search and return a subarray that I could easily manipulate, but it seems the only way to do that is with macros. Currently I think I can use VLOOKUP, but I don't really understand enough about it know if I can use this with another function.
Essentially, if there is a formula or a combination of formulas that I can use that will allow me to collect all data from column B that shares the same values in column A, I could nest that in the formulas I need to calculate the data.
Any help is appreciated!
This can be done with a pivot table in just a few clicks.
First, turn the source data into an Excel Table object, by selecting one cell in the table and then using Insert > Table or Ctrl-T. Add a helper column for the calls over 20 seconds. Let the column be "long calls" and the formula
=IF([#Duration]>TIME(0,0,20),1,0)
Then, with a cell of the Excel Table selected, click Insert > Pivot Table. (The pivot table is now linked to the Excel Table object and when more data is added you can refresh the pivot table without having to change the definition of the source data.)
Drag the Day field into the rows area and the Duration field into the Values area. Right-click any of the value results in the pivot table, and in the Value Field Settings dialog select Max. Then click on Number Format button and set the custom number format of hh:mm:ss. Confirm all dialogs.
If you want to format the date, right click any of the visible dates in the Pivot table, select Field Settings, click Number Format and then set the custom format ddd.
Drag the duration field into the values area again and set its calculation method to Average.
Drag the "long calls" field into the values area.
Hide the Grand Totals via the Pivot Table tools Design ribbon command.
Now you can add more data to the table in columns A to B, right click the pivot table and select refresh.

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.

Use Excel countifs with unique values

I have the following sheet:
I then use the following formula to count the number of each type in each area/country:
=COUNTIFS($B$2:$B$19,"UK",$C$2:$C$19,"A") and I get the following result:
My problem is that I only want the same name to be counted once per area/country, therefore the value for UK / A should be 4, not 8. Does anyone know how to accomplish this?
Regards
Crouz
Concatenate your name/location columns and do your countif using that. It's not pretty, but it will do what you want.
I would do a pivot on a pivot. Both should be in classic pivot table format.
Let me walk you through the logic:
1st Pivot
Pivot your initial data. Format pivot to be classic (right click -> PivotTable Options -> Display -> Classic .. -> ok)
As Row labels have Location, Type and Name. in Values put anything you want i have chosen count of Name.
Remove subtotals, grand totals from pivot and Repeat item labels or columns Location and Type(i am assuming you have excel >= 2010). http://www.extendoffice.com/documents/excel/1964-excel-repeat-item-labels.html
2nd pivot
Pivot your 1st pivots data. Pivot to classic view. in Row Labels have Location and Type and in values whatever you want os count i have chosen count of Location. Remove sub/grand totals and repeat items and your done.
This is what i have
Another alternative is to remove the duplicates. On the data tab, click on remove duplicates. It will then all you for the criteria to use. Select all three columns. It should then work as you expect

Identifying the Pivot Table fields for each row (Excel)

I have a data table, and this corresponding pivot table:
For each row in the pivot table, I'd like to know which field the row label refers to. So for the highlighted orange cell C17, I would like to return "First Name" (as you can see by hovering over cell A17).
I have some constraints that mean I need to use the pivot table in compact form. It would be easy if I could just use an outline or tabular layout, but I'm restricted to using a single column for my row labels.
Any ideas please? I'm happy to take solutions using either VBA or built-in Excel functions. Thanks!
In the highlighted cell, use the following formula: =IF(ISNA(MATCH(A17,$A$2:$A$7,0)),$B$1,$A$1)
This will work unless the Last Name also is a First Name that appears in your list.

Filtering pivot table columns, only count if

I was wondering if it's possible to filter a single pivot table column in excel.
In other words, when you summarize the data by count, that the data for a certain column is only counted if it has a certain value.
I know that it's possible to get these values by report filtering, but then I need a separate pivot table for the values I don't want to be filtered. Also, some values are 0 and thus are not displayed if report-filtered. Changing the option to display 0 values doesn't change anything. Thanks in advance.
Yes, you can add a filter to a pivot report by selecting a cell that borders the table (but is outside the pivot area) and choosing Filter from the Data tab.
To add a filter to just the Count Of column select the cell above and the cell containing the title and then choose the Filter option from the menus as shown...
To only count data if it fulfills a certain condition, I think you would need to add another column called OK to the source data, with a formula like IF(Status="OK",1,0). Then add this to the pivot table layout. [Note: there is a calculated field option for pivot tables but it only seems to work as you would expect if data is displayed - in this case status would need to be showing.]
That's not working on my Excel 365. Try selecting the 1st field on the first row then:
r-click
filter
value filters...
Left click on any row items drop-down carrot
Click 'value filter'
Choose value filter ('equals', 'greater than', etc)
Choose value field item you'd like it to filter on (eg 'count of days' from the image i can see in the original question)
You can also do it via the right click options as #kztd mentioned

Resources