asked on

# If formula to return 0 when same and 1 when different

Hi Experts using excel 2010

I havethe following if formula...

IF(BB19=BA19,0,IF(BC19=BB19,0,IF(BD19=BC19,0,IF(BE19=BD19,0,IF(BF19=BE19,0,1)))))

Which should when the previous date is the same as current date return 0 and when different return 1...cannot get it to work. Keeps on returning 0 all the time.
Subodh Tiwari (Neeraj)

Maybe this...

``=IF(OR(BB19=BA19,BC19=BB19,BD19=BC19,BE19=BD19,BF19=BE19),0,1)``
Professor J

can u upload a sample file.  the reason you get zero is that in all nested IFS the condition for true is 0 so that would mean that any of these BB19=BA19 BC19=BB19 BD19=BC19 BF19=BE19 are returning true meaning that any of these equal statement are true and therefore it will not reach to the end.
SOLUTION
Subodh Tiwari (Neeraj)

membership
Create an account to see this answer
Signing up is free. No credit card required.

ASKER

Firstly thanks for the feed back still get a zero.

So.assume row 1
Date 1        Date 2        Date 3       Date 4
Rows 2
01/02/16   02/02/16    02/02/16   03/02/16
Hence end result should be 2 date 1 and 2 are different and 3 and 4..
ASKER CERTIFIED SOLUTION

membership
Create an account to see this answer
Signing up is free. No credit card required.

ASKER

Apologies projimjam..

End result should be 2 hence two date differences. My fault.. sorry.
please see attached.
Book1.xlsx