# Sheets ArrayFormula with SUMIF

In a 'Records' sheet I have columns of timestamp, a duration, and a category (i.e. 13 minutes of 'B' was done at 18/01/2021 00:00).

In the 'Analysis' sheet I have a field where the Type can be defined and then using Filter the matching rows are shown and can be worked with to create a 'Sum since' tally.

I am failing to write a formula for a single cell that will produce the array in the D column in Analysis. I can do this just fine assuming there is no 'Type' by using Arrayformula and Sumif, but it seems that Sumifs cannot be used with array formula, and query cannot be used with duration data.

Can anyone give me any pointers or better yet a working formula? The correct answer would slot into a larger formula I already have for a moving weighted average.

• Please read how to and share a test sheet so as you can be easier helped. Also include the formulas you now use as well as the expected results – marikamitsos Feb 13 at 20:39
• Thanks @marikamitsos I've updated the question with a test sheet link – user3623437 Feb 13 at 21:08
• What would your expected results be for column `E`? Please update your sheet with them in column `G`. – marikamitsos Feb 13 at 21:31
• The correct answers are in column D in the sample sheet but I am not able to produce them with a single arrayformula – user3623437 Feb 13 at 21:35

`=ArrayFormula(IF(B2:B="",,SUMIF(IF(ROW(B2:B),ROW(B2:B)),">="&ROW(B2:B),C2:C)))`
The initial `IF(B2:B="",,` just leaves cells blank if the corresponding cell from Column B of that row is also blank.
The opening `IF(ROW(B2:B),ROW(B2:B))` of the `SUMIF` creates an array of all row numbers from `B2:B`, which can then be matched for each row against the condition to only include those that are greater than or equal to the current row (with durations in `C2:C` being summed accordingly).