Reputation: 15
I have survey data on teacher quality with possible responses being 1-4. No one reported 1, so it won't automatically show in the pivot table I am trying to create.
This is what I'm working with. Again, I want to add a "1" column, and it should display 0% or a blank cell.
I have looked into calculated fields and messed around with functions and also dummy variables (an additional column listing 1-4 to insert into the pivot table), but I haven't been able to crack the code myself.
Upvotes: 0
Views: 953
Reputation: 7949
In order to include zero values in the pivot table, create results that can be included in the pivot table.
DATA
=countif($A$2:$A$16,"="&B2)/COUNT($A$2:$A$16)
PIVOT TABLE
SAMPLE DATA
PIVOT TABLE EDITOR
Upvotes: 0
Reputation: 29904
Alternatively you could try a formula-based approach for your ideal output scenario:
=let(Σ,sequence(1,4), Λ,A2:A,
arrayformula({Σ;to_percent(countif(Λ,Σ)/counta(Λ))}))
Upvotes: 1