Home > Enterprise >  How to add a third argument to google sheets countif function
How to add a third argument to google sheets countif function

Time:02-16

=IF((COUNTIF(G3:M3;"Banana")>=1);"YES";"NO")

How can I add a third argument if G3:M3 is empty string I need "Nothing in your basket"

CodePudding user response:

Use nested IFs to return multiple answers. Values can be replaced by functions that return values. Too many values can make for a nasty formula, but in your case it's pretty simple...

Example: =IF(ISBLANK(G3:M3),"Nothing in your basket",IF(COUNTIF(G3:M3,"Banana")>=1,"YES","NO"))

Have fun!

CodePudding user response:

Try this using IFS instead of IF:

=IFS((COUNTIFS(G3:M3,"Banana") >=1),"YES",{G3:M3} = "","EMPTY",(COUNTIFS(G3:M3,"Banana") <=1 ),"NO")

Output:

enter image description here enter image description here enter image description here

  • Related