Excel formula COUNTIF decimal number

Solved
ralouf -  
 ralouf -

Hello,

I would like to know which formula to use to count the number of cells that contain a decimal number and another formula that counts the cells containing an integer. I assume I need to use COUNTIF, but I'm not sure what criteria to write.

Actually, the final objective is to determine the number of cells that contain an even number vs an odd number. I haven't found any other way than dividing the numbers by 2, so if the result gives a decimal number, that means it's an odd number. That's why I need to be able to count the cells that contain a decimal value.

But if you have a faster solution to determine whether the numbers are even or odd, without going through the step of dividing by 2 and counting decimal numbers, I’m all ears.

Thank you :)

2 réponses

cousinhub29 Posted messages 1112 Registration date   Status Membre Last intervention   383
 

Hello,

This formula tells you if the cell contains an even number:

 =IS.EVEN(A1)

(IS.ODD for odd numbers)

And to count the number of even values in a range of cells (here A1:A2), you can use this formula:

 =SUMPRODUCT(--(MOD(A1:A2,2)=0))

Have a great rest of the afternoon


0
ralouf
 

Thank you, I was able to finish my project thanks to you :-D

Have a good evening! :-)

0
yclik Posted messages 68 Registration date   Status Membre Last intervention   1 604
 

Hello

a proposal

 =SUMPRODUCT((IS.EVEN(A2:A5)*(MOD(A2:A5,1)=0))) =SUMPRODUCT((IS.ODD(A2:A5)*(MOD(A2:A5,1)=0))) =SUMPRODUCT(MOD(A2:A5,1)>0) 
0