# If function in data range

Solved/Closed
eyji - Jun 12, 2010 at 02:35 AM
eyji - Jun 12, 2010 at 01:18 PM
Hello,
does anyone know how to solve this:

In a data range of say A1:A10, if all entries are "YES", give me "YES"; otherwise give me "No"

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
770
Jun 12, 2010 at 04:02 AM
=IF(COUNTIF(A1:A10, "=YES") = 10, "YES", "NO")
hi thanks, this is really helpful just a follow up question, what if the cell is blank , or n/a, it should also result to yes. The only time that is should reflect NO is if there is one or more NOs in any of the range.....can you help please? thanks so much
oh...never mind, I just followed your logic and reversed the argument to IF(COUNTIF(A1:A10,"NO")>1,"NO","YES"

Again thank you much for lading me to the correct logic and formula :-)
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
770
Jun 12, 2010 at 10:11 AM
Well one way would be simply reverse the logic

=IF(COUNTIF(A1:A10, "=NO") >0, "NO", "YES")
got it, thank you so much