I'm trying to use Excel to sum up the values in a column conditionally. Here's the current formula I'm trying to use:
=SUMIF(D3:D22,IF(ISNUMBER(D3),D3>0,$C3>0),$B3:$B22)
I have a column of data in column B, which I want my formula to sum up for all its values from between rows 3 and 22 inclusive, but only if the corresponding cell in column D has a positive value. However, not all cells in the range D3:D22 are numerical values. For all cases where it is not, I want to check if the adjacent cell in column C, rather than D, is positive. (All the cells in the range C3:C22 are numerical values.)
The inner IF formula works just fine, producing the correct TRUE or FALSE result as intended. However, the SUMIF formula does not accept the TRUE or FALSE statement, and instead produces a calculation of 0 in each case.
Is there any better formula I can use in this case, where I need the formula to essentially be responsive to the result of the conditional IF formula for the cell two columns over from it?
Here's what I've tried so far: the Microsoft support pages explaining the SUMIF and SUMIFS formulae, respectively. Unfortunately, SUMIFS is completely useless in this case, because I only have one condition for the cell in question, and I only need one criterion to be met anyway, not all of them. As a result, I would run into the same problem with SUMIFS as I do using SUMIF. The SUMIF article is definitely helpful, but it does not cover what to do in scenarios where the inner "condition" statement contains a formula that returns either TRUE or FALSE.
I have also tried the Evaluate Formula option under the Formula Auditing section in the Formulas tab of the Excel program, but it computes the entire SUMIF calculation in a single step, so I can't really pinpoint where it went wrong. However, I can obviously see that it's the "condition" part (second term in the SUMIF formula) that poses the problem where everything goes wrong anyway.
Is there any way to compute Excel SUMIF formulas that use a nested boolean formula in the condition slot, such as the one described above? If not, what are some possible replacements that I could suitably substitute for it?