Calculated field with column subitems?

YounesB3

Board Regular
Joined
Mar 28, 2012
Messages
148
Hi, I have a source data which I can't change because if I add a column with a formula, it will make the file that much heavier.

I'd like to calculate a simple ratio of calculations. Here's a simulated example of what I'd like.

Column AColumn B
ABYes1
ABNo
EF-
CD-
ABYes2
CD-
ABYes3
ABNo
ABYes1

<tbody>
</tbody>


Basically, I want a calculated field of a ratio of i/j:
i =being a countifs of all the AB and Yes1, Yes2, Yes3
j = being a countif of all the AB.

It would be easy by adding a new column, but I can't. I thought that it would be possible with a calculated field in a pivot table, but I can't find the option to do what I want. Any help would be appreciated.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Maybe this:
Code:
=SUMPRODUCT(--(A:A="AB"),--(LEFT(B:B,3)="Yes"))/COUNTIF(A:A,"AB")
 
Upvote 0
Maybe this:
Code:
=SUMPRODUCT(--(A:A="AB"),--(LEFT(B:B,3)="Yes"))/COUNTIF(A:A,"AB")

Hi the "Yes" were examples. It's actually 3 different labels.

Also, this would be the pivot calculated field? You can have ranges in the calculated field?
 
Upvote 0
Just do each individual label and add them up:
Code:
=(COUNTIFS(A:A,"AB",B:B,"Yes1")+COUNTIFS(A:A,"AB",B:B,"Yes2")+COUNTIFS(A:A,"AB",B:B,"Yes3"))/COUNTIF(A:A,"AB")
You can replace the entire column references with specific range references, i.e. change A:A to A1:A100, if you like.

I don't really work with pivot calculated fields, so really cannot answer that question for you.
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,851
Members
449,194
Latest member
HellScout

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