I have customer list and a list of invoices.
(我有客户清单和发票清单。)
I want to basically calculate a sumif customer name equals the invoice name. (我想基本上计算一个sumif客户名称等于发票名称。)
The data set can be rather large and there will be multiple sumif/countif procedures. (数据集可能很大,并且会有多个sumif / countif过程。)
Is there a better way to do this rather than VBA "sumif", for example summing the values within a collection and priting it out?
(有没有比VBA“ sumif”更好的方法,例如,将集合中的值求和然后进行推算?)
I already have the customers in a collection as per code below. (根据下面的代码,我已经有一个集合中的客户。)
What would be the most efficient way to do sumif/countif procedures for the following collection? (在以下集合中执行sumif / countif过程的最有效方法是什么?)
Sub UniqueCustomers()
Dim arr As New Collection, a
Dim LastLine As Integer
Dim aFirstArray As Variant
Dim i As Long
n = 1
ThisWorkbook.Sheets("List").Select
aFirstArray = Worksheets("List").Range("B2", Range("B2").End(xlDown))
On Error Resume Next
For Each a In aFirstArray
arr.Add CStr(a), CStr(a)
Next
On Error GoTo 0
Dim Customer As Variant
For Each Customer In arr
Worksheets("Customers").Cells(n + 19, 5).Value = Customer
Debug.Print Customer
n = n + 1
Next Customer
End Sub
ask by Carlsberg789 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…