How to SUM Absolute Values in SUMIFS function?

ibmy

Board Regular
Joined
Mar 4, 2020
Messages
106
Office Version
  1. 2016
Platform
  1. Windows
Hi expert Excellers,

Currently I use these 2 formula to calculate sum of set data at certain range of times. Both produce same result.
Now, I interested in sum of absolute value. The data consist of postive and negative values.

1)
Excel Formula:
=SUMIFS($G$2:$G$200000,$D$2:$D$200000,">="&K5,$D$2:$D$200000,"<"&TIME(HOUR(K5)+4,MINUTE(K5),0))

2)
Excel Formula:
=SUMIFS($G$2:$F$200000,$D$2:$D$200000,”>=”&K11,$D$2:$D$200000,”< “&K12)

G column : Set of data
D column : 24 hour time
K cell : Time Range from D column

I searched on web, and found out that I need to use ABS function, but do not know how to put the function in current formula as criteria2?/criteria 3?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
You can use:

Excel Formula:
=SUM(SUMIFS($G$2:$G$200000,$G$2:$G$200000,{"<0",">0"},$D$2:$D$200000,">="&K5,$D$2:$D$200000,"<"&TIME(HOUR(K5)+4,MINUTE(K5),0))*{-1,1})

and

Excel Formula:
=SUM(SUMIFS($G$2:$G$200000,$G$2:$G$200000,{"<0",">0"},$D$2:$D$200000,">="&K11,$D$2:$D$200000,"<"&K12)*{-1,1})
 
Upvote 0
Solution
For 1st formula Try this array formula
VBA Code:
=SUM(IF(($D$2:$D$200000>=K5)*($D$2:$D$200000<TIME(HOUR(K5)+4,MINUTE(K5),0)),IF($G$2:$G$10>0,$G$2:$G$10,-1*($G$2:$G$10)),""))

Similarly for 2nd formula.

To enter ARRAY formula
Copy and paste the formula in cell
Press F2
Press Ctrl+Shift+Enter together
Excel covers the formula with {}.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

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
Back
Top