# Microsoft Office Application Help - Excel Help forum > Excel Charting & Pivots >  > [SOLVED] Count percentage in Pivot table using two Count column

## LeeWen

How to count percentage in Pivot table using two Count columns.

I'm using "=Yes/'Variable ' ", but I get error. Please help.

Thanks in advance.

----------


## dflak

You ran into one of the "quirks" of pivot tables. They will yield a number if you count nonnumerical data. Unfortunately, you can't use this number in calculations.

So, you have to play with the source data. I added two helper columns to your source data:
Var Count =1
Yes Count =IF([@Yes]="Yes",1,0)

The first formula simply assigns 1 for each variable. The second formula is 1 if the value is YES and zero otherwise. I calculated the percentages off the helper columns.

----------


## LeeWen

> You ran into one of the "quirks" of pivot tables. They will yield a number if you count nonnumerical data. Unfortunately, you can't use this number in calculations.
> 
> So, you have to play with the source data. I added two helper columns to your source data:
> Var Count =1
> Yes Count =IF([@Yes]="Yes",1,0)
> 
> The first formula simply assigns 1 for each variable. The second formula is 1 if the value is YES and zero otherwise. I calculated the percentages off the helper columns.



Thank you very much! It's working.

----------


## rorya

FWIW you could also do it in Power Pivot by loading the data into the data model then creating simple counta measures for each then another measure that just divides those two. See attached.

----------

