Forum Discussion
Needing a little help in understanding the logic I am trying to use IF and COUNT IF
Hi all. I have two separate worksheets, one of which needs to be connected to another. On Sheet 1 for column K, I have either "true" or "false". In Sheet 2 for cell B6, I want to count all the number of "true"s from Sheet 1. No "false" cells will be counted.
I am sure my logical thinking is off here. =if('Sheet 1'!K2:K29="true", "Sheet 2"=countif(B6)). How close did I get to what I wanted to do? If the formula is wrong, what formula should I have been using? Thanks very much for your help on this.
- Haytham AmairahSilver Contributor
Hi Scott,
Please try this formula:
=COUNTIF(Sheet1!K:K,TRUE)
- scottkramer.14Copper ContributorThanks for you suggestion. I tried it and the answer came up 0, which I thought was odd.
- Haytham AmairahSilver Contributor
Hi Scott,
I guess that the TRUEs and FALSEs are parsed as texts, and it seems that the COUNTIF function cannot handle this situation!
So please replace the previous formula with this:
=SUMPRODUCT(--(K:K="TRUE"))
Hope that helps