sumifs help needed

smgomez

New Member
Joined
Nov 13, 2009
Messages
48
I have the following formula that is not working. Here is what I want the formula to do in cell B2 of the total worksheet: sum columns H-K from the sub worksheet where the sum of columns F and G <0 where the value in sub worksheet column A matches the value in column A in the total worksheet. The values in column A on both worksheets is an employee number and there are many instances of the same value

=SUMIFS(Sub!H$2:Sub!K$2,Sub!A$2:Sub!A$904,A2,Sub!F$2:Sub!G$2,"<0")

SUB WORKSHEET

1605196679491.png


TOTAL WORKSHEET
AB
321654
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
10,770
Try:

=SUMPRODUCT(Sub!$H$2:$K$904*(Sub!$A$2:$A$904=A1)*(Sub!$F$2:$F$904+Sub!$G$2:$G$904<0))

Adjusting the ranges as necessary.
 

smgomez

New Member
Joined
Nov 13, 2009
Messages
48
Thank you for the formula, I think we are close. The value I get with this formula is zero, I should get $710.02. I also changed =A1 to =A2
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
10,770
With the Sub sheet like this:

Book1
ABCDEFGHIJK
232165400710.02000
33216541299221
Sub


I get this on the Total sheet:

Book1
AB
1
23216540
Total
Cell Formulas
RangeFormula
B2B2=SUMPRODUCT(Sub!$H$2:$K$20*(Sub!$A$2:$A$20=A2)*(Sub!$F$2:$F$20+Sub!$G$2:$G$20<0))


The way you explained it, and with your example, I'd expect a value of zero. Do you mean that you want to sum the values if the sum of the F:G columns is less than OR EQUAL to 0? If so, change the formula to:

Rich (BB code):
=SUMPRODUCT(Sub!$H$2:$K$20*(Sub!$A$2:$A$20=A2)*(Sub!$F$2:$F$20+Sub!$G$2:$G$20<=0))
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,127,870
Messages
5,627,362
Members
416,245
Latest member
Xterminat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top