This is a "nested" subtotal problem.
First of all - yes I know that subtotal will not include other subtotal functions in the same column.
The main issue is that I am using a Subtotal function as part of an IF statement, and it's not adding up the non-subtotal part of the IF.
If I change the Subtotal to be a SUM then it works as expected.
I think, Excel is seeing the subtotal function anywhere in the formula and ignoring the entire cell.
This is the formula in cell L5:
=IF(AND(E5<>"",F5="Yes"),E5,SUBTOTAL(9,L6:L11))
Explained: IF (E5 is not blank, and F5 is YES) then use the value in E5, if false, then subtotal L6:L11.
to reproduce the problem create a subtotal of L4 to L12.
It will not include the value in L5 if the statement is true.
In layman's terms: If the user sets F5 to Yes, use the allowance amount in E5, if not calculate the subtotal for the lines below.
I am assuming this is expected, but in all my years of Excel formulas, I've never seen this.
Is there a way around this without using a 2nd column, to gather the amounts and total there?
I have proved that if I use a 2nd column and just say that column = the column I want to total, it will work as needed.
But that is a rebuild of the entire design.
Regards,
Sepp.
Bookmarks