# Help with IF / And / OR

#### jas64

##### New Member
I am not sure that I'm using the most efficient approach to what I'm trying to achieve. Input and advice is most welcome. I'm sure this is a simple formula, but I'm not having and success with it.

 IF(AND( A1 > 9, and < 20, and B1 = "PHONE"), (DO THIS)

<tbody>
</tbody>
 -OR-

<tbody>
</tbody>
 IF(AND( A1 > 20, and B1 = "PHONE"), (DO THIS)

<tbody>
</tbody>

### Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

#### Nine Zero

##### Well-known Member
try this out just replace the DO THIS with what you want

=IF(AND(A1>9,A1<20,B1="PHONE"),DO THIS,IF(AND(A1>20,B1="PHONE"),DO THIS,""))

#### jproffer

##### Well-known Member
Is this on the right track? :

Code:
``=IF(AND(A1>9,A1<20,B1="PHONE"),"DO THIS IF 9 to 20",IF(AND(A1>20,B1="PHONE"),"DO THIS IF over 20","BOTH CONDITIONS FALSE"))``
BTW, you may want to decide which category you want if A1 is exactly 20. With this formula, as it is now, if A1 = 20, both cond would be false.

Last edited:

#### jas64

##### New Member
Thanks! That works. I swore that I tried that, but I'm thinking I misused a parentheses.

#### jtakw

##### Well-known Member
Hi,

How about this slightly shorter version, assumes - DO THAT if > 9 and <= 20

<b></b><table cellpadding="2.5px" rules="all" style=";background-color: rgb(255,255,255);border: 1px solid;border-collapse: collapse; border-color: rgb(187,187,187)"><colgroup><col width="25px" style="background-color: rgb(218,231,245)" /><col /><col /><col /></colgroup><thead><tr style=" background-color: rgb(218,231,245);text-align: center;color: rgb(22,17,32)"><th></th><th>A</th><th>B</th><th>C</th></tr></thead><tbody><tr ><td style="color: rgb(22,17,32);text-align: center;">1</td><td style="text-align: right;;">20</td><td style=";">PHONE</td><td style=";">DO THAT</td></tr></tbody></table><p style="width:5.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid rgb(187,187,187);border-top:none;text-align: center;background-color: rgb(218,231,245);color: rgb(22,17,32)">Sheet66</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: rgb(255,255,255)" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">C1</th><td style="text-align:left">=IF(<font color="Blue">B1="PHONE",IF(<font color="Red">A1>20,"DO THIS",IF(<font color="Green">A1>9,"DO THAT","A1 is less than 10"</font>)</font>),"B1 is Not PHONE"</font>)</td></tr></tbody></table></td></tr></table><br />

Last edited:

Threads
1,089,901
Messages
5,411,113
Members
403,342
Latest member
faizanhamied