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