simple IF question

  • Thread starter Thread starter bokey
  • Start date Start date
B

bokey

How do I write a formula that would evaluate a cell and return different
values?

IF cell = 1 or 2, return "A", if cell = 3, 4 or 5, return "B"
 
How do I write a formula that would evaluate a cell and return different
values?

IF cell = 1 or 2, return "A", if cell = 3, 4 or 5, return "B"

Try this:

=IF(OR(Cell=1;Cell=2);"A";IF(OR(Cell=3;Cell=4;Cell=5);"B";"")).
 
=if(or(a1={1,2}),"A",if(or(a1={3,4,5}),"B","not 1, 2, 3, 4, or 5"))

or

=if(or(a1=1,a1=2),"A",if(or(a1=3,a1=4,a1=5),"B","not 1, 2, 3, 4, or 5"))
 
Try this:
=IF(OR(Cell=1;Cell=2);"A";IF(OR(Cell=3;Cell=4;Cell=5);"B";"")).

You can "tighten" that formula up some...

=IF(OR(Cell={1,2}),"A",IF(OR(Cell={3,4,5}),"B",""))

Note: My system uses commas (instead of semi-colons) as argument delimiters.

Rick
 
Both formulas worked Thank you for sharing.

Rick Rothstein (MVP - VB) said:
You can "tighten" that formula up some...

=IF(OR(Cell={1,2}),"A",IF(OR(Cell={3,4,5}),"B",""))

Note: My system uses commas (instead of semi-colons) as argument delimiters.

Rick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top