Sumifs within an Array?

xceej

New Member
Joined
Jun 21, 2018
Messages
10
Is it possible to do a sumifs within an array? I have a large data set (circa 20,000 rows) that I am working on and one of the elements is a sumifs. Currently I'm creating most of the array, pasting it to a sheet, and then updating the remainder of the array by running the sumifs on the sheet.

This works but I feel/hope there is a more efficient solution. Below is my code, the 1st line is the actual sumifs I'm running on the sheet; the 2nd is as far as I've got trying to complete it within the array. Example 1 the code doesn't run and is giving me an "Argument not optional" error. Example 2 I have 0s in the Row_Num optional column, and the code runs up to this point but I get a "Subscript out of range" error.
NB I am running a loop on the data prior to this, so all the data needed is populated within the array.
Any help would be appreciated!

'Example 1
For i = 7 To LRow 'Last row
'TimeArr(i, Time.Total_Daily_FTE) = WF.SumIfs(TimeWS.Range("F:F"), TimeWS.Range("C:C"), TimeArr(i, Time.Employee), TimeWS.Range("E:E"), TimeArr(i, Time.Date))

TimeArr(i, Time.Total_Daily_FTE) = WF.SumIfs(WF.Index(TimeArr(), , Time.Hours), WF.Index(TimeArr(), , Time.Employee), TimeArr(i, Time.Employee), WF.Index(TimeArr(), , Time.Date), TimeArr(i, Time.Date))
next i

'Example 2
For i = 7 To LRow 'Last row
'TimeArr(i, Time.Total_Daily_FTE) = WF.SumIfs(TimeWS.Range("F:F"), TimeWS.Range("C:C"), TimeArr(i, Time.Employee), TimeWS.Range("E:E"), TimeArr(i, Time.Date))

TimeArr(i, Time.Total_Daily_FTE) = WF.SumIfs(WF.Index(TimeArr(), 0, Time.Hours), WF.Index(TimeArr(), 0, Time.Employee), TimeArr(i, Time.Employee), WF.Index(TimeArr(), 0, Time.Date), TimeArr(i, Time.Date))
next i
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi, If you can, give another example, explaining what data you have, what conditions they meet, what they should add and what result you expect.

Please try prepare a data example using add-in specifically for this and it can be found here XL2BB
Pay attention to this post XL2BB 2 Square
 
Upvote 0

Forum statistics

Threads
1,214,515
Messages
6,119,972
Members
448,933
Latest member
Bluedbw

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