Combine SumIF with IF
19:59 11 Jun 2025

I have a data base "A:D" with multiple entries per day with 2 types of data on "C" and "D" (will omit # "B" to simplify"). I want to make a double entry table "F:J" with 2 variables, Distance and Cost, as header and column, so I have all the possible combination in this table, this act as a condition if the results on the database are ">" than Header/Column, for example >10 & >-15, >25 & >-15.

I could get a total of values with SumIf, but what I need is not that total, but the total sum of the result of a true/false statement values like an IF function on each row, a total sum of each column on the table "L:M"

For example:

IF(AND($D3>-10;$C3>=10);"10";"-10")  
IF(AND($D4>-10;$C3>=10);"10";"-10")  

according to the data this will result in a total of "20".

This is made in the table "L:W" but I want to avoid adding a column for every possible combination of results.

So there's any way to get all the combinations with the if statement values in the table "F:J"??

EDIT: with blackcat formula, I can get the sum of the positive values, I need the total so I need to subtract the total sum of those entries that don't meet any of the criteria. I tried to reverse that formula to get if doesnt meet "x" or "y" it gets a negative number, but the issue I have is that for example the yellow one, doesn't meet any criteria, so the formula count it as 2 instead of 1 failure

excel excel-formula