Percent of Total - How to build report

zico8

Board Regular
Joined
Jul 13, 2015
Messages
227
Hi,

I have some task - that looks like very easy, but... I cannot find solution :(

I have data like this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Column1[/TD]
[TD]Column2[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]No[/TD]
[/TR]
</tbody>[/TABLE]

And want to get report showing the percent of Yes/Total:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Column1[/TD]
[TD]Yes/Total[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]33,33%[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]50,00%[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]66,67%[/TD]
[/TR]
</tbody>[/TABLE]

How to build that?
Does Pivot Table do this? Or I need some transformation in PowerQuery?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Would this be any use?
Formula in E2 is copied down.

Excel Workbook
ABCDE
1Column1Column2
2ANoA33.33%
3AYesB50.00%
4ANoC66.67%
5BNo
6BYes
7CYes
8CYes
9CNo
10
% Yes
 
Upvote 0
The result is OK but I am looking for some solution that I can create that report automatically in the gentle way - no matter how many data I have in my table.
More advanced sample thet need to be solved too is to have two parameters for each record of my table, like:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Column1[/TD]
[TD]Column2[/TD]
[TD]Column3[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]X[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]Y[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]Y[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]X[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Y[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Y[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD]Y[/TD]
[TD]No[/TD]
[/TR]
</tbody>[/TABLE]

with result:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]X (Yes/Total)[/TD]
[TD]Y (Yes/Total)[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]50,00%[/TD]
[TD]0,00%[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]100,00%[/TD]
[TD]0,00%[/TD]
[/TR]
[TR]
[TD]C[/TD]
[TD][/TD]
[TD]66,67%[/TD]
[/TR]
</tbody>[/TABLE]


so... I think that should be some solution to do this with PT
 
Upvote 0
Hi,

I have found that if I change each "Yes" to 1, and each "No" to 0 - creating these reports will be very easy in Pivot Table.
But is there any way to do it?
 
Upvote 0
Hi,

I have found that if I change each "Yes" to 1, and each "No" to 0 - creating these reports will be very easy in Pivot Table.
But is there any way to do it?

You can pull the yes/no column into your pivot table (column) and then compute the column percentage.

XBcY5JN.jpg
 
Upvote 0
archangel99 - what you added to each field?
Rows: 'Header1';
Columns: 'Header2', 'Y/N';
Values: ??
 
Upvote 0
But the result is different and incorrect.
Please see B+X. We have only YES, so the result for YES should be 100%
 
Last edited:
Upvote 0
Again this is without a PT, but see if any use.

Data in columns A:C is made into a formal table ('Table1' for me). This allows automatic expansion/contraction of the results.
Formula in E2 is copied down as far as you might ever need.
Formula in F2 is copied across and down as far as the column E formulas.

Excel Workbook
ABCDEFG
1DataX/YY/NXY
2AXNoA,$E2,Table1:],F$1,Table1:],&quot;Yes&quot;)/COUNTIFS(Table1:],$E2,Table1:],F$1),&quot;&quot;)]50.00%0.00%
3AXYesB100.00%0.00%
4AYNoC66.67%
5BYNo
6BXYes
7CYYes
8CYYes
9CYNo
10
11
% of Total
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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