excel countif function
Author
Discussion

FunkyGibbon

Original Poster:

3,863 posts

294 months

Friday 24th March 2006
quotequote all
Anyone know if you can use the countif function in the following manner - as I can seem to work it out?

count the number of items in column F only if the corresponding cell column B = 1

TIA

boiler

217 posts

285 months

Friday 24th March 2006
quotequote all
As you are counting the number 1, you could multiply the countif function by the value in column F. Something like this...

=F1*COUNTIF(B1,1)

thegreenhell

24,167 posts

249 months

Friday 24th March 2006
quotequote all
COUNTIF will only tell you the number of instances of the value "1" in column B.
If you want to use this value as a trigger to add up the values in column F (which is what I think you are asking) then use the SUMIF function.

eg. =SUMIF(B1:B12,1,F1:F12) will add up the numerical values contained in the cells in column F only if the corresponding cell in column B is equal to 1.

Hope that helps.

FunkyGibbon

Original Poster:

3,863 posts

294 months

Friday 24th March 2006
quotequote all
thegreenhell said:
COUNTIF will only tell you the number of instances of the value "1" in column B.
If you want to use this value as a trigger to add up the values in column F (which is what I think you are asking) then use the SUMIF function.

eg. =SUMIF(B1:B12,1,F1:F12) will add up the numerical values contained in the cells in column F only if the corresponding cell in column B is equal to 1.

Hope that helps.


that should do it.

thanks.