如何测量Excel计算时间

例如,我怎么能find什么公式更快?

=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") 

VS把这两个领域重新build立一个新的专栏,

  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 

从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中的自动刷新,以确保它没有时间任何其他计算。

在VBA中你可以使用Timer

 time1 = Timer 'Your code time2 = timer totaltime = time2-time1