Find if a value is in a range

sadsfan

Board Regular
Joined
Apr 30, 2003
Messages
217
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello.
I have a range of cells (e.g. A1:U1), these have numbers in them and I need a formula to check if there is the number 1 in any of the cells, if there is I need to return a value of "Y" and if there isn't a value of "N".

Can anyone help?
 

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.
How about
=IF(COUNTIF(A1:U1,1)>0,"Y","N")
 
Upvote 0
Thank you very much! I had to do a slight tweak because I made a mistake in my original post! But after that it worked perfectly.

=IF(COUNTIF(A1:U1,1)=0,"Y","N")
 
Last edited:
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0
Thank you very much! I had to do a slight tweak because I made a mistake in my original post! But after that it worked perfectly.

=IF(COUNTIF(A1:U1,1)=0,"Y","N")
You can simplify that formula slightly...

=IF(COUNTIF(A1:U1,1),"N","Y")
 
Upvote 0

Forum statistics

Threads
1,215,404
Messages
6,124,715
Members
449,184
Latest member
COrmerod

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