[Solved] Sum cells in a range with specific values

Discuss the spreadsheet application
Post Reply
Synthex
Posts: 10
Joined: Tue Feb 25, 2014 9:14 pm

[Solved] Sum cells in a range with specific values

Post by Synthex »

What is formula to sum the values in a range that meet specific criteria: I need to sum numbers that have negatuve values -0,10 and -0,38.
I tried SUMIF function to sum the values, but this don't works:

Code: Select all

=SUMIF(F5:F60; "-0,10; -0,38")
Last edited by Synthex on Tue Jan 23, 2024 2:18 am, edited 1 time in total.
Version: 7.0.4.2 on Linux Debian
User avatar
MrProgrammer
Moderator
Posts: 4909
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Sum values in a range that meet specific criteria

Post by MrProgrammer »

Synthex wrote: Tue Jan 23, 2024 12:21 am I need to sum numbers that have negatuve values -0,10 and -0,38.
[Tutorial] The SUMPRODUCT function

If your post meant that you want to sum every negative value.
=SUMPRODUCT(F5:F60;F5:F60<0)

If you meant that you want to sum only those two specific values, ignoring any other negative values, use:
=SUMPRODUCT(F5:F60;F5:F60=-10E-2)+SUMPRODUCT(F5:F60;F5:F60=-38E-2)    or
=SUMPRODUCT(F5:F60=-10E-2)*-10E-2+SUMPRODUCT(F5:F60=-38E-2)*-38E-2
The first sums those two values in the range. The second multiplies your two values by their counts in the range.

If you need any additional assistance attach a spreadsheet demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the spreadsheet itself). I will not help further unless you attach.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.

[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Synthex
Posts: 10
Joined: Tue Feb 25, 2014 9:14 pm

Re: Sum values in a range that meet specific criteria

Post by Synthex »

MrProgrammer wrote: Tue Jan 23, 2024 1:45 am If you meant that you want to sum only those two specific values, ignoring any other negative values, use:
=SUMPRODUCT(F5:F60;F5:F60=-10E-2)+SUMPRODUCT(F5:F60;F5:F60=-38E-2)    or
=SUMPRODUCT(F5:F60=-10E-2)*-10E-2+SUMPRODUCT(F5:F60=-38E-2)*-38E-2
I meant second case. It works, Thank you.
Version: 7.0.4.2 on Linux Debian
Post Reply