View Single Post
  #4   Report Post  
Bernd Plumhoff
 
Posts: n/a
Default

Hi dede,

If I interprete smart=efficient and dumb=not_as_efficient then this might be
your example:

Task: Count the occurences of Thursdays between 1-Jan-2005 and 26-Jan-2005.

"Dumb" function:
=SUM(--(WEEKDAY(ROW(INDIRECT(1/1/5&":"&1/26/5)))=4))

"Smart" function (by Daniel M.):
=INT((1/26/5-WEEKDAY(1/26/5+1-4)-1/1/5+8)/7)

Both functions calculate the correct result 4. But the "dumb" function needs
about 20x more execution time (due to FastExcel) since it first generates
the whole date sequence and counts all occurences then.

HTH,
Bernd