Excluding a column from COUNTIF function

Lux8

New Member
Joined
Aug 13, 2024
Messages
3
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hello,

I have this formula that calculates a score based on a Yes or No response that is working fine - =COUNTIF(D2:AE2,"Yes")/(COUNTIF(D2:AE2,"Yes")+COUNTIF(D2:AE2,"No"))

However, I need to edit it to exclude Column "X" (which is in between my range of D2 to AE2), from the calculation. What is the best way to do so?

I tried editing it this way - =COUNTIF(D2:W2 : Y2:AE2,"Yes")/(COUNTIF(D2:AE2 : Y2:AE2,"Yes")+COUNTIF(D2:AE2 : Y2:AE2, "No")), but it still seems to be calculating "X" column's value.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Your syntax is wrong, but that wouldn't work with COUNTIF anyway. Do any of the cells have values other than Yes or No? (eg blank)
 
Upvote 0
can you subtract the values in column X

=COUNTIF(D2:AE2,"Yes")/(COUNTIF(D2:AE2,"Yes")+COUNTIF(D2:AE2,"No"))

=(COUNTIF(D2:AE2,"Yes") - COUNTIF(X2:X2,"Yes")) / ((COUNTIF(D2:AE2,"Yes")+COUNTIF(D2:AE2,"No"))) - what eles is in column X ???

=(COUNTIF(D2:AE2,"Yes") - COUNTIF(X2:X2,"Yes")) / ((COUNTIF(D2:AE2,"Yes")+COUNTIF(D2:AE2,"No")) - (COUNTIF(X2:X2,"Yes")+COUNTIF(X2:X2,"No")))
OR
perhaps a SUMPRODUCT
 
Upvote 0
Solution
Your syntax is wrong, but that wouldn't work with COUNTIF anyway. Do any of the cells have values other than Yes or No? (eg blank)
They do have NA as well, except for X column, which is Yes or No only
 
Upvote 0
Perhaps:

Excel Formula:
=(COUNTIF(D2:AE2,"Yes") - (X2="Yes")) / (COUNTIF(D2:AE2,"<>NA")-(X2<>"NA"))
 
Upvote 0
can you subtract the values in column X

=COUNTIF(D2:AE2,"Yes")/(COUNTIF(D2:AE2,"Yes")+COUNTIF(D2:AE2,"No"))

=(COUNTIF(D2:AE2,"Yes") - COUNTIF(X2:X2,"Yes")) / ((COUNTIF(D2:AE2,"Yes")+COUNTIF(D2:AE2,"No"))) - what eles is in column X ???

=(COUNTIF(D2:AE2,"Yes") - COUNTIF(X2:X2,"Yes")) / ((COUNTIF(D2:AE2,"Yes")+COUNTIF(D2:AE2,"No")) - (COUNTIF(X2:X2,"Yes")+COUNTIF(X2:X2,"No")))
OR
perhaps a SUMPRODUCT
I think i've managed to crack it using your logic of subtracting. Seems like this is working as expected - =(COUNTIF(D2:AE2,"Yes") - COUNTIF(X2:X2,"Yes")) / ((COUNTIF(D2:AE2,"Yes") - COUNTIF(X2:X2,"Yes")) + (COUNTIF(D2:AE2,"No") - COUNTIF(X2:X2,"No")))
 
Upvote 0
Actually, If col X is only ever Yes or No, you can just subtract 1 at the end:

Excel Formula:
=(COUNTIF(D2:AE2,"Yes") - (X2="Yes")) / (COUNTIF(D2:AE2,"<>NA")-1)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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