Tricky Countif

  • Thread starter Thread starter gregork
  • Start date Start date
G

gregork

Hi,
I need help with a formula for a countif:
Based on the range A23:A39....
If one or more cells in the range = "apples", cell value = "apples"
If only all cells in the range (ignoring blanks) = "oranges" , cell value =
"oranges"
Otherwise , cell value = ""

I think I need a countif formula for this but I am not sure how to write it.

Regards
gregork
 
Hi Gregor,

Try

=IF(COUNTIF(A23:A39,"apples")=COUNTA(A23:A39),I1,"")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Transcription error, should be

=IF(COUNTIF(A23:A39,"apples")=COUNTA(A23:A39),A23,"")


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Interpreting literally...

=IF(ISNUMBER(MATCH("apples",A2:A7,0)),"apples",IF(COUNTIF(A2:A7,"<>oranges")
=COUNTIF(A2:A7,"="),"oranges",""))

if you mean only empty cells by "blanks", otherwise:

=IF(ISNUMBER(MATCH("apples",A2:A7,0)),"apples",IF(COUNTIF(A2:A7,"<>oranges")
=SUMPRODUCT(--(A2:A7="")),"oranges",""))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top