PIVOT Count Only " - " in table

surkdidat

Well-known Member
Joined
Oct 1, 2011
Messages
594
Office Version
  1. 365
Is there anyway of creating a Pivot to count the number of occurrences of "-" when the columns and rows match?

I know I can do this by INDEX MATCH MATCH (or similar) but would prefer it in a pivot, that way I can get asy access on the data when clicking on the info?
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
sss[table="width: 500, class: grid"]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[/table]


any example of source for your "pivot" ?
[table="width: 500, class: grid, align: center"]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[tr]
[td][/td]
[td][/td]
[td][/td]
[/tr]
[/table]
 
Upvote 0
so I want to create a Pivot with Names in the rows, and the categories as columns

[table="width: 500"]
[tr]
[td]Name[/td]
[td]Contacted[/td]
[td]Appointment[/td]
[td]Sale[/td]
[/tr]
[tr]
[td]Claire[/td]
[td]1[/td]
[td]2[/td]
[td]1[/td]

[/tr]
[tr]
[td]Dan[/td]
[td][/td]
[td]1[/td]
[/tr]

[/table]


[table="width: 500, class: grid"]
[tr]
[td]ID[/td]
[td]Name[/td]
[td]Date[/td]
[td]Contacted?[/td]
[td]Appointment[/td]
[td]Sale[/td]

[/tr]
[tr]
[td]111[/td]

[td]Adam[/td]
[td]02/06/2019[/td]
[td]Yes[/td]
[td]Yes[/td]
[td]Yes[/td]
[/tr]

[tr]
[td]222[/td]
[td]Ben[/td]
[td]01/06/2019[/td]
[td]Yes[/td]
[td]Yes[/td]
[td]Yes[/td]

[/tr]


[tr]
[td]333[/td]
[td]Claire[/td]
[td]02/06/2019[/td]
[td]Yes[/td]
[td]-[/td]
[td]-[/td]
[/tr]
[tr]
[td]444[/td]
[td]Dan[/td]
[td]02/06/2019[/td]
[td]Yes[/td]
[td]-[/td]
[td]Yes[/td]
[/tr]
[tr]
[td]555[/td]
[td]Claire[/td]
[td]02/06/2019[/td]
[td]-[/td]
[td]-[/td]
[td]Yes[/td]
[/tr]
[/table]


In this Pivot I want it to say



any example of source for your "pivot" ?
 
Upvote 0
something like this?

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]ID[/td][td=bgcolor:#5B9BD5]Name[/td][td=bgcolor:#5B9BD5]Date[/td][td=bgcolor:#5B9BD5]Contacted?[/td][td=bgcolor:#5B9BD5]Appointment[/td][td=bgcolor:#5B9BD5]Sale[/td][td][/td][td=bgcolor:#70AD47]Name[/td][td=bgcolor:#70AD47]Value[/td][td=bgcolor:#70AD47]Appointment[/td][td=bgcolor:#70AD47]Sale[/td][td=bgcolor:#70AD47]Contacted?[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
111​
[/td][td=bgcolor:#DDEBF7]Adam[/td][td=bgcolor:#DDEBF7]
02/06/2019​
[/td][td=bgcolor:#DDEBF7]Yes[/td][td=bgcolor:#DDEBF7]Yes[/td][td=bgcolor:#DDEBF7]Yes[/td][td][/td][td=bgcolor:#E2EFDA]Claire[/td][td=bgcolor:#E2EFDA]-[/td][td=bgcolor:#E2EFDA]
2​
[/td][td=bgcolor:#E2EFDA]
1​
[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
222​
[/td][td]Ben[/td][td]
01/06/2019​
[/td][td]Yes[/td][td]Yes[/td][td]Yes[/td][td][/td][td]Dan[/td][td]-[/td][td]
1​
[/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
333​
[/td][td=bgcolor:#DDEBF7]Claire[/td][td=bgcolor:#DDEBF7]
02/06/2019​
[/td][td=bgcolor:#DDEBF7]Yes[/td][td=bgcolor:#DDEBF7]-[/td][td=bgcolor:#DDEBF7]-[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
444​
[/td][td]Dan[/td][td]
02/06/2019​
[/td][td]Yes[/td][td]-[/td][td]Yes[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
555​
[/td][td=bgcolor:#DDEBF7]Claire[/td][td=bgcolor:#DDEBF7]
02/06/2019​
[/td][td=bgcolor:#DDEBF7]-[/td][td=bgcolor:#DDEBF7]-[/td][td=bgcolor:#DDEBF7]Yes[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
 
Upvote 0
Yes, please, thank you :)

something like this?

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]ID[/td][td=bgcolor:#5B9BD5]Name[/td][td=bgcolor:#5B9BD5]Date[/td][td=bgcolor:#5B9BD5]Contacted?[/td][td=bgcolor:#5B9BD5]Appointment[/td][td=bgcolor:#5B9BD5]Sale[/td][td][/td][td=bgcolor:#70AD47]Name[/td][td=bgcolor:#70AD47]Value[/td][td=bgcolor:#70AD47]Appointment[/td][td=bgcolor:#70AD47]Sale[/td][td=bgcolor:#70AD47]Contacted?[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
111​
[/td][td=bgcolor:#DDEBF7]Adam[/td][td=bgcolor:#DDEBF7]
02/06/2019​
[/td][td=bgcolor:#DDEBF7]Yes[/td][td=bgcolor:#DDEBF7]Yes[/td][td=bgcolor:#DDEBF7]Yes[/td][td][/td][td=bgcolor:#E2EFDA]Claire[/td][td=bgcolor:#E2EFDA]-[/td][td=bgcolor:#E2EFDA]
2​
[/td][td=bgcolor:#E2EFDA]
1​
[/td][td=bgcolor:#E2EFDA]
1​
[/td][/tr]

[tr=bgcolor:#FFFFFF][td]
222​
[/td][td]Ben[/td][td]
01/06/2019​
[/td][td]Yes[/td][td]Yes[/td][td]Yes[/td][td][/td][td]Dan[/td][td]-[/td][td]
1​
[/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
333​
[/td][td=bgcolor:#DDEBF7]Claire[/td][td=bgcolor:#DDEBF7]
02/06/2019​
[/td][td=bgcolor:#DDEBF7]Yes[/td][td=bgcolor:#DDEBF7]-[/td][td=bgcolor:#DDEBF7]-[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td]
444​
[/td][td]Dan[/td][td]
02/06/2019​
[/td][td]Yes[/td][td]-[/td][td]Yes[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]
555​
[/td][td=bgcolor:#DDEBF7]Claire[/td][td=bgcolor:#DDEBF7]
02/06/2019​
[/td][td=bgcolor:#DDEBF7]-[/td][td=bgcolor:#DDEBF7]-[/td][td=bgcolor:#DDEBF7]Yes[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]
 
Upvote 0
so use PowerQuery (Get&Transform)

Code:
[SIZE=1]// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Type = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}, {"Date", type date}, {"Contacted?", type text}, {"Appointment", type text}, {"Sale", type text}}),
    Unpivot = Table.UnpivotOtherColumns(Type, {"ID", "Name", "Date"}, "Attribute", "Value"),
    Filter = Table.SelectRows(Unpivot, each ([Value] = "-")),
    Group = Table.Group(Filter, {"Name", "Attribute", "Value"}, {{"Count", each Table.RowCount(_), type number}}),
    Pivot = Table.Pivot(Group, List.Distinct(Group[Attribute]), "Attribute", "Count")
in
    Pivot[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top