Forum Discussion
IF ISBLANK and NOT
Hi all,
I am banging my head against a brick wall trying to figure this out.
Column C has a day in it.
Cell X6 has a value in it which automatically updates every day.
Column X has new values entered every day.
The value in column AM for each row is calculated with a formula, so it will give the value of X6 if X in the same row is empty, or 0 if X in the same row has a value.
=IF(ISBLANK(X324),X$6,0) will give me what I want if just looking at the cell in row X, but I also need to check if C324 is either Saturday or Sunday.
=IF(AND(OR($C327="Saturday",$C327="Sunday"),(ISBLANK(X327))),0,X$6) will give me 0 if X327 is Blank and C327 is either Saturday OR Sunday, but will not give me 0 if X327 is Blank and C327 is not Saturday or Sunday.
Is there a way to use the NOT function with the ISBLANK to say if X327 is Blank and C327 is not either Saturday or Sunday then it will return value X6, but is any of those statements are not true then it returns 0.
Thanks in advance...
2 Replies
- m_tarlerBronze Contributor
Yes you can use NOT() in that statement. I think you want:
=IF(AND(NOT(OR($C327="Saturday",$C327="Sunday")),(ISBLANK(X327))),0,X$6)Alternatively I think the following should also work:
=IF(OR($C327="Saturday",$C327="Sunday",NOT(ISBLANK(X327))),0,X$6)and finally there is a difference between ISBLANK() and ="" but if in this case either works you could use
=IF(OR($C327="Saturday",$C327="Sunday",X327<>""),0,X$6)wait I take that all back, what I think you want is just an OR statement
=IF(OR($C327="Saturday",$C327="Sunday",ISBLANK(X327)),0,X$6) - mathetesSilver Contributor
I can't swear I followed all of your logic, but here's a formula that appeared to work as I understood it. If I got one of the conditions backwards, you should be able to change it. A couple of things to note:
I used the function WEEKDAY to determine whether the date in column C is a Sat or Sun.
I used the comparator <> to mean "not equal"
So one part of the formula reads this way in order to return "TRUE" if the date is neither Sunday (1) or Saturday (7)
AND(......WEEKDAY(C10,1)<>1),WEEKDAY(C10,1)<>7)
The complete formula, then, is simply
=IF(AND(ISBLANK(X10),WEEKDAY(C10,1)<>1,WEEKDAY(C10,1)<>7),$X$6,0)
Note, I did the testing in row 10 of my spreadsheet.
(For future reference, if you could actually attach a spreadsheet, or include a link to it on a shared drive, that would provide more incentive for people to help. Otherwise, you're kind of forcing us to create our own. Any actual that you provide should not include proprietary or confidential info, but in this case it should be fairly easy for you to create what you've described.)