Calcuating a sum where 'yes' and 'no' values invert

The Grim Discovery

Board Regular
Joined
Jan 23, 2015
Messages
246
Office Version
  1. 365
Platform
  1. Windows
Hello folks

This is crazing me.

As you'll see the formula below works out the percentage of counts of 'yes' against a total of counts of 'yes' and 'no' in the range of D13:D16. So far so ok.

=SUM(COUNTIF(D13:D16,"Yes")/(COUNTIF(D13:D16,"Yes")+COUNTIF(D13:D16,"No")))

[So if D13:D15 ="yes" and D16='"no" I'd get a result of 75%.]

But I want to extend the range to D13:D17 but where in D17 a 'No' effectively counts as a 'Yes' and vice versa. Each time I try and bolt this into the formula it all goes awry and doesn't return a correct % result. If anyone can a) make sense of this query and b) give me a hand, it would be appreciated.
Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
how about

=SUM(COUNTIF(D13:D16,"Yes")+COUNTIF(D17,"No"))/(COUNTIF(D13:D17,"Yes")+COUNTIF(D13:D17,"No"))
 
Upvote 0
I was also wondering why not use COUNTA as the denominator?

=SUM((COUNTIF(D13:D16,"Yes")+COUNTIF(D17,"No"))/COUNTA(D13:D17))
 
Upvote 0
it might have some rather than yes and no, eg. don't know
 
Upvote 0
Alan and Dim - cheers for your interest and help.
Alan, that cracked it for me - many thanks.
(And yes there are other values such as 'don't know', 'valid reason' and 'not applicable' as well as 'yes' and 'no'.)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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