Return a set value if any cell in a range equals a given #

starrpnvm

New Member
Joined
Apr 13, 2004
Messages
15
I have a range of cells (C8:G8) that looks like: 2, 7, 13, 14, 20

I have another cell (C5) that has the value of 13

I am trying to get a formula to enter the number "1" in another cell (C6) if any of the values in the range (C8:G8) equals the number 13.

Is there an easy way to do this?
I have tried if(C8:G8=C5, 1, 0) but it does not seem to work.

Any help is appreciated
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
=IF(COUNTIF(C8:G8,C5),1)

The formula above will check the range for whatever number is in C5. So if you change it to say 2, 7, 14 or 20 it will still give you a 1. If it's any other number it will return FALSE.
 
Upvote 0
Re: Return a set value if any cell in a range equals a given

I have a range of cells (C8:G8) that looks like: 2, 7, 13, 14, 20

I have another cell (C5) that has the value of 13

I am trying to get a formula to enter the number "1" in another cell (C6) if any of the values in the range (C8:G8) equals the number 13.

Is there an easy way to do this?
I have tried if(C8:G8=C5, 1, 0) but it does not seem to work.

Any help is appreciated

C6:

=ISNUMBER(MATCH(13,C8:G8,0))+0
 
Upvote 0
I had the same problem and it worked perfectly. Saved me like 10 days. You guys rock ty so much.
 
Upvote 0

Forum statistics

Threads
1,222,561
Messages
6,166,800
Members
452,073
Latest member
akinch

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