Countif function

%3CLINGO-SUB%20id%3D%22lingo-sub-2499238%22%20slang%3D%22en-US%22%3ECountif%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2499238%22%20slang%3D%22en-US%22%3E%3CP%3EI%20want%20to%20count%20the%20number%20of%20times%20%220%22%20is%20found%20in%2010%20individual%20cells%2C%20not%20in%20a%20range.%20What%20is%20the%20formula%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2499238%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2499597%22%20slang%3D%22en-US%22%3ERe%3A%20Countif%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2499597%22%20slang%3D%22en-US%22%3EYou%20could%20try%3A%3CBR%20%2F%3E%3DINDEX(FREQUENCY((A1%2CA3%2CA5%2CA7%2CA9%2CA11%2CA13%2CA15%2CA17%2CA19)%2C%7B-1E-25%2C0%7D)%2C2)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2501559%22%20slang%3D%22en-US%22%3ERe%3A%20Countif%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2501559%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F675152%22%20target%3D%22_blank%22%3E%40JMB17%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20the%20formula%20%3Dindex(frequency((A1%2CA3%2CA5%2CA7%2CA9%2CA11%2CA13%2CA15%2CA17%2CA19(%2C%7B-1E-25%2C0%7D)%2C2)%20worked%20well.%20However%20when%20finding%20the%20same%20value%20subsituting%20%220%22%20for%20%221%22%2C%20%222%22%20and%20%223%22%20respectively%20did%20not%20work.%3C%2FP%3E%3CP%3ECould%20you%20explain%20the%20formula%20and%20suggest%20the%20correct%20formula%20for%20find%20the%20number%20of%20times%201%2C2%20and%203%20occur%20in%20the%2010%20cells.%3C%2FP%3E%3CP%3EWhy%20use%20index%20and%20not%20just%20frequency%3F%20What%20is%20the%20significance%20of%20%7B-1e-25%2C0)%2C2).%20I%20am%20assuming%20the%200%20is%20the%20value%20we%20are%20seeking%20to%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I want to count the number of times "0" is found in 10 individual cells, not in a range. What is the formula ?

5 Replies
You could try:
=INDEX(FREQUENCY((A1,A3,A5,A7,A9,A11,A13,A15,A17,A19),{-1E-25,0}),2)

@JMB17 

 

Thanks the formula =index(frequency((A1,A3,A5,A7,A9,A11,A13,A15,A17,A19(,{-1E-25,0}),2) worked well. However when finding the same value subsituting "0" for "1", "2" and "3" respectively did not work.

Could you explain the formula and suggest the correct formula for find the number of times 1,2 and 3 occur in the 10 cells.

Why use index and not just frequency? What is the significance of {-1e-25,0),2). I am assuming the 0 is the value we are seeking to know.

 

Thanks

@GrahamA1010 

 

Frequency will return an array with an element count 1 more than the bins_array argument (number of elements within the braces { }).

 

I included -1E-25 as I wasn't sure if your data included negatives or decimals. So, -1E-25 should, I believe, group everything below 0. Then, the 0 element should capture the 0's as well as everything between it and the next element in the bins_array, but since it is the last element the frequency function automatically groups everything greater than it into another element (and is why the function always returns an array 1 element greater than the number of elements in bins_array).

 

In this example, you can see frequency is returning 3 elements, everything below zero, zero, everything above zero. So, index is used to pull out the second element.

 

JMB17_0-1625063409988.png

 

If you're just dealing with integer data, then you should be able to count the 1's with:

=INDEX(FREQUENCY((A1,A3,A5,A7,A9,A11,A13,A15,A17,A19),{0,1}),2)

 

If decimal data, then I believe you could use:

=INDEX(FREQUENCY((A1,A3,A5,A7,A9,A11,A13,A15,A17,A19),{0.999999999999999,1}),2)

 

@JMB17 

 

Thank you very helpful.

What do you know about prediction, a series of whole numbers either a "0" or a "1" , can we predict what the next number will be, will it be a "0" or will it be a "1".

 

I would love hear your thoughts. 

Sorry, but prediction is outside my realm.