Using IF Function where logical test is for range of values = YES

slourenco2017

New Member
Joined
Jul 31, 2017
Messages
2
Hi all,

I am trying to create a formula (see below) whereby it reads an entire range of data and outputs "YES" or "NO". Is the IF formula suitable for this purpose?

=IF($B$4:$B$19="YES","YES","NO")

Thanks.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
What is in the B4:B19 range? If the word "Yes" is in that range and you want to return how many times that word appears, you can use:

=COUNTIF($B$4:$B$19, "YES")

Otherwise, your formula should work fine.
 
Upvote 0
Welcome to the board.

It's a little unclear exactly what you're wanting to test for.

Test if ALL cells in $B$4:$B$19 = "YES"
Or
Test if ANY one or more cells in $B$4:$B$19 = "YES"


For if ALL cells = Yes
=IF(COUNTIF($B$4:$B$19,"<>YES"),"NO","YES")

For if Any one or more = Yes
IF(COUNTIF($B$4:$B$19,"YES"),"YES","NO")
 
Upvote 0
@Jonmo1, to clarify, I'm testing for the first case in your note - Test if ALL cells in $B$4:$B$19 = "YES". I'll try to be more specific in future posts.

Your method works - thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,021
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top