Excel Pivot Table Count Unique Values - excel

I have a pivot table like so
Field Count of Field
Value1 1
Value2 4
Value3 6
The field that shows the summation of the count shows 11 which is correct but how do I just show the unique values in Field (which is 3 in this case)

Count the values in the Excel column and subtract 1 for the Pivot header and 1 for the Grand Total (if showing).

Related

excel pivot table - count appearance of certan value in column

let's say i have folowing data for my excel pivot table:
country_id user_id answer
---------- ------- ------
1 1 Y
1 2 Y
2 3 N
2 4 Y
3 5 N
i would like to count how many "Y" i have per country.
If i put "answer" in Values as "Count of answer" i get 1 for each row. How can i count only "Y" answers?
so the result will be:
country_id answerY
----------- -------
1 2
2 1
3 0
br
Y
I have a solution similar to #pkg. Add one more column in your data and call it "answerY" with the formula:
=IF(C4="Y",1,0)
or, if your data is in a table:
=IF([#answer]="Y",1,0)
Now, set up your pivot table as follows:
Row lables: country
Values: answerY (sum)
Ordinarily I'd say to add a calculated field in a pivot table, but calculated fields work off of the aggregate values, and I can't think of a way to do this with a straight pivot table.
If you have the ability to use PowerPivot, you could create a custom column or a Dax expression that would handle this.
I'm not sure you can do that in a pivot table, but if you would like to do it outside of a pivot table you could make a couple of columns with these formulas:
Column D:
=IF(C2="Y",1,0)*A2
Column E:
=COUNTIF(D$2:D$6,B2)
This assumes that all user IDs are unique and sequential, and D$6 needs to be replaced with whatever is the last value in the column. Column E will have the values you described as answerY.

Excel Pivot Table-Hiding specific Column Value

I have a pivot table that looks like below.
Critical
Yes No Total
1 3 4
1 2 3
3 0 3
4 1 5
I need to Hide the No column from the pivot but shouldn't impact total column. I have tried using Hide "No" column but that changes the value in Total field.
TIA.

ABS(column) not working in Excel PivotTable Grand Total

I have a Pivot Table in Excel with a Calculated Field but the Grand Total in the Pivot table doesn't seem to work as you would expect.
You would think that the Grand Total for Column Sum of abs value is the Total of the cells in the column....
abs(1) + abs(3) = 4
IE, the should be column
But it seems to be ignoring that column's cells and using the data source column [value] or the Sum of value column ...
abs(1 + -3) = 2
Calculated Field :=
abs value = ABS(value)
pivot table
level Sum of value Sum of abs value should be (not currently part of the pivot table)
a 1 1 1
b -3 3 3
-------------------------------------------- -----
Grand -2 2 4
Total
I found this incredibly old knowledge article: KB211470 Calculated field returns incorrect grand total in Excel. But, it has no work around.
I can't make modifications to the raw data and I'd like a solution that works with-in the Pivot Table. I'm happy to use DAX/PowerPivot as well. (The results are the same there by the way so it seems the cause is in how the Pivot table works.)
Am I doing something wrong?
Thank you.

Counting duplicate rows using Excel

I need to count the number of duplicate occurrences of values in a column using excel, ONLY for rows with a certain value in second column i present.
Column1 Column2
value1 x
value1 x
value1 x
value1
value2 x
value2
value3 x
---> should give
VALUE Occurencies
value1 3
value2 1
valu3 1
How to do this?
Thanks!
You can use a pivot table, which does not require any typing of values or any formulas.
Drag column1 into the row area and column2 into the values. If it is text, it will be counted. If the other values in column 2 are blank you are done. If they contain values, you can drag column2 into the filters area and then use the filter dropdown above the pivot table to select what value in column2 to use.
After you add new data to columns A and B, select the pivot table and refresh it.
If Column1 is in A1, please try:
=COUNTIFS(A:A,D2,B:B,"<>")
copied down to suit where D2... contain Value1 etc

Two Tables Excel values

I have two tables in two different sheets. In Table 1 and table 2 column 1 is for id's. but in Table 2 I have more id's than table 1.
What I want is: if a cell in table 2 column 2 is filled to check the id and if its in table 2 to mark "yes" in column 2 in Table 1.
This is the code I have been using but it stops when the ids don't match:
=IF(AND(Table 2[column 2]>0,VLOOKUP([column 1],Table 2[column 1],1,FALSE)=sheet 2!A5),"yes","")
You could put something like this in table 1 column 2. Assuming table 1 is in columns A,B and Table 2 is in columns D,E. That is column D is the id in table 2 and column E is the value in table 2.
This will return an error if there is an id in table 1 that isn't in table 2. To deal with this you could wrap it with iferror.
=IF(INDEX($E:$E,MATCH(A1,$D:$D,0))>0,"yes","")
Gordon
You might try:
=IFERROR(IF(VLOOKUP(Table1[[#This Row],[column 1]],Table2[#All],2,0)<>"","yes",""),"")
at the top of column 2 of Table1, adding spaces in the table names if you have been able to.

Resources