View Single Post
  #7   Report Post  
Myrna Larson
 
Posts: n/a
Default

Hi, Harlan:

FWIW, since you refer to the number of function calls, I assume your concern
is with speed. Your proposed formula may be shorter, but if speed is the
issue, arithmetic functions generally beat text/string functions (plus
under-the-hood conversion of text to dates/times).

I tried these two formulas, with the numbers 1028 and 1328 in cells A1 and B1:

=INT(B1/100)*60+MOD(B1,100)-(INT(A1 / 100) * 60 + MOD(A1, 100))

and

=(TEXT(B1,"00\:00")-TEXT(A1,"00\:00"))*1440

Charles Williams's FastExcel says the first takes 77 microseconds, the second
105 microseconds.

Myrna


On Sat, 22 Jan 2005 15:16:09 -0800, "Harlan Grove" wrote:

"Rob van Gelder" wrote...
Assuming one of your times is in A1

=INT(A1 / 100) * 60 + MOD(A1, 100)

...

2 function calls for each time value. Can reduce this to 1. Given two times
as integers in A1 and A2, with A1 < A2, the minutes between them could be
calculated as

=(TEXT(A2,"00\:00")-TEXT(A1,"00\:00"))*1440