acr
acr

Reputation: 1746

Excel if statement with greater than condition

In my excel sheet called main, I am referring to 2 cell values

Main C9 -   dd-mm-yyyy   
Main C10 -  (number)

Now on another sheet, Below conditions I am checking.

If month on Main C9 and month on main C9+1 are equal,If this is equal next condition ie, if day on Main c9 is grater than number on main C10. If this condition is true current cell value should be 0 and if it is not true, value should be 1. And In first if statement ie, Main C9 and month on main C9+1 are equal, if it false, I have to show value as 1 in current cell.

I am using below formula, but somehow it is not working.

=IF(TEXT(Main!$C$9,"mmm")=TEXT(Main!$C$9+1,"mmm"),IF(TEXT(DAY(Main!$C$9),"d")>Main!C$10,0,1),1)

Can you let me know if I am missing something here ?

Upvotes: 2

Views: 232

Answers (1)

nightcrawler23
nightcrawler23

Reputation: 2066

I think your aprroach is ok, but don't use TEXT,

see if this works

=IF(MONTH(C9)=MONTH(C9+1),IF(DAY(C9)>C10,0,1),1)

Upvotes: 4

Related Questions