ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I use a range of numbers in an if statement? (https://www.excelbanter.com/excel-worksheet-functions/49693-how-do-i-use-range-numbers-if-statement.html)

pbeattie

How do I use a range of numbers in an if statement?
 
I would like to use a range of numbers in an IF statement. As an example
IF("C8 =3,4,or5",25,0) which is meant to read if cell C8 is equal to the
number 3, the number 4, or the number 5, then show 25, if not show 0. Is
there a simple way to write this range of numbers into this IF statement?

Thanks,

Peo Sjoblom

Sure, try

=IF(OR(C8={3,4,5}),25,0)


Regards,

Peo Sjoblom


"pbeattie" wrote in message
...
I would like to use a range of numbers in an IF statement. As an example
IF("C8 =3,4,or5",25,0) which is meant to read if cell C8 is equal to the
number 3, the number 4, or the number 5, then show 25, if not show 0. Is
there a simple way to write this range of numbers into this IF statement?

Thanks,




Richard Buttrey

On Mon, 10 Oct 2005 14:16:03 -0700, "pbeattie"
wrote:

I would like to use a range of numbers in an IF statement. As an example
IF("C8 =3,4,or5",25,0) which is meant to read if cell C8 is equal to the
number 3, the number 4, or the number 5, then show 25, if not show 0. Is
there a simple way to write this range of numbers into this IF statement?

Thanks,



IF(OR(C8=3,C8=4,C8=5),25,0)

or if the test is anything between 3 and 5 inclusive

=IF(AND(C8=3,C8<=5),25,0)

Rgds
__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________


All times are GMT +1. The time now is 05:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com