Need help with this formula.

Copper Contributor

I have this formula so far.  It works correctly to add the values in the range ($F$7:$F$110) when the cells in the range ($C$7:$C$110=C112) but I also need it to subtract the values in the range F if the criteria range C is equal to C113 rather than the C112. in the same formula.  Any help would be appreciated thank you in advance. 

=L57+SUMPRODUCT(($C$7:$C$110=C112)*$F$7:$F$110)

5 Replies

@jakuzi1 

Perhaps

 

=L57+SUMIFS($F$7:$F$110, $C$7:$C$110, C112)-SUMIFS($F$7:$F$110, $C$7:$C$110, C113)

thank you but the formula did not work. It only subtracted the values in range f7:f110. It did not start with the original value L57 nor did it add any of the values it needed to add in range f7f110.

@jakuzi1 

Apparently I don't understand what you want.

Could you provide an example that shows what you want the formula to do?

@HansVogelaar Thanks for your help.  I do not know how to attach my workbook to this forum, but I was able to receive help from another form and I have the solutions now.  The below formula does what I wanted and its much simpler than what I started with.

=L15+SUM((IF(C7:C110=C112,1,-1))*F7:F110)

 

@jakuzi1 

I'm glad you have something that suits you, but that formula solves a different problem than what you asked in your first post.