例如,我怎样才能找到更快的公式?
=SUMPRODUCT((Data!D:D="RC Corp")*(Data!AD:AD="Expected Allowances / Provisions"))
Vs的
=COUNTIFS(Data!D:D,"RC Corp",Data!AD:AD,"Expected Allowances / Provisions")
将两个字段合并到一个新列并执行
Z1 = D1&AD1
=Countif(Data!Z:Z,"RC CorpExpected Allowances / Provisions")
Vs VBA
Dim i as integer
Dim Total as integer
Total = 0
i=0
While i < 1000
IF Range("D"&i).Value = "RC Corp" AND Range("AD"&i).Value = "Expected Allowances / Provisions" Then
Total = Total + 1
End If
Wend
Range("$A$1").Value = Total
答案 0 :(得分:4)
从evocandy的回答中醒来,我想出了这个基本代码。
time1 = Timer
Range("A1").Calculate ' Or the cell containing the Formula I want. OR use Sheets("Sheet1").Calculate for the calculation including concated columns
time2 = Timer
CalculationTime = Time2-Time1
为了使其工作,我必须将样本数据隔离到新的空工作表并禁用Excel中的自动刷新,以确保它不会计算任何其他计算。
答案 1 :(得分:2)
在VBA中,您可以使用Timer
。
放
time1 = Timer
'Your code
time2 = timer
totaltime = time2-time1