Ignore cells with 0 in COUNTIF formula

laurenwydo

New Member
Joined
May 16, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I already have the formula, I just need it to exclude cells with a 0.

=COUNTIFS(Cash!Q:Q, "2", Cash!F:F, "1")/COUNTIFS(Cash!F:F, "1")

Basically, in the Q:Q range, there's either a 1, 2 or 0. At the moment there is one "2" and eight "1" and I want the output of the formula to provide me 11% (1/9), but its counting all the cells with 0, which there are 9, and providing 6% (1/18).

Any help would be greatly appreciated!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
1715889248613.png
 
Upvote 0
I am so sorry, I just had to add data to the sheet and totally spaced that I did.

The number should now be 1/11 vs what it is calculating 1/22. Basically, make the formula ignore all the 0's.
 
Upvote 0
There are no 0 in column F.
Do you mean counting all 1 in column F where there is no 0 in column Q?
Then you should have added this condition to the second COUNTIFS().
 
Upvote 0
Try
Excel Formula:
=COUNTIFS(Cash!Q:Q,2,Cash!F:F,1)/COUNTIFS(Cash!Q:Q,"<>0",Cash!F:F,1)
 
Upvote 1
Solution

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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