# Not Equal to, if statement

#### john_utah

##### New Member
This is super easy for the experts but I can't figure this out with 2 arguments

If cell D9 does not equal "WI" or "IA" then return a 1 - otherwise display 0

#### DanteAmor

##### Well-known Member
Hi @john_utah, welcome to the forum

Try his

=IF(AND(D9<>"WI",D9<>"IA"),1,0)

#### JayStax

##### New Member
This is super easy for the experts but I can't figure this out with 2 arguments

If cell D9 does not equal "WI" or "IA" then return a 1 - otherwise display 0
Try this:

Code:
``````dim sheet1 as worksheet
dim range1 as range 'declare the sheet and the range(the cell)

Set sheet1 = 'insert sheet
set range1 = sheet1. 'reference after period

if sheet1.range1 <> "WI" OR if sheet1.range1 <> "IA" then

'return a 1 wherever youre tying to it

else

'return a 0

end if``````

#### DanteAmor

##### Well-known Member
It can also be

=IF(OR(D9="WI",D9="IA"),0,1)

#### Scott Huish

##### MrExcel MVP
For returning 1 or 0, the IF isn't necessary:

=1-(OR(D9={"WI","IA"}))

#### john_utah

##### New Member
This one worked perfectly! Thank you for the welcome as well! I didn't think of trying the and statement with this.

### Forum statistics

1,082,323
Messages
5,364,586
Members
400,809
Latest member
formulasataglance

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...