|I don't understand what you are trying to do.|
However, I can tell you a couple of things that are wrong with your formula.
Let's take the first part...
First, formulas never have to start with a parenthesis, so we can shorten it to this:
Second, there is no need for parenthesis around the value_if_false argument, so we can shorten it further to this:
Ok, so what you are saying with that is:
If N2 is greater than 1 AND less than 31, return E2, otherwise return 0.
That part makes sense.
Now, as for the second part of your formula, there's a lot there that doesn't make sense.
First, the + sign tells Excel to ADD the results of that part of the formula to the results of the first part (your IF function). + means SUM
Even though I know that that is not what you want to do, let's look at how that AND function works, so you'll understand why you are getting the results you are.
AND will return TRUE when all of the arguments it is testing are TRUE and FALSE if any one or more of them are FALSE. In addition, within Excel TRUE = 1 and FALSE = 0
So, when you use AND($D2>0,(0),$E2) the 0 argument in the middle is evaluated as FALSE causing the entire AND to be evaluated as FALSE or 0.
What you actually have then is this:
Since I don't know waht you are trying to do with that AND function at the end, I can't tell you how to rewrite the formula.
Maybe if you tried to explain it with some actual values, that might help.
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.