Charles Williams of FastExcel put together a survey asking his visitors to tag the best and worst functions in Excel. Indirect and Offset are high on that list which makes me question my first post's mapping formula; Indirect even got its own Excel's Most Evil Function post! This post fixes my dynamic mapping formula by using hero functions and then looks at the readability and performance differences.
The original "SuperNeighborhood" formula was:
The new "FastSuperNeighborhood" formula is:
I prototyped diagnostic VBA code to calculate the columns and return the execution time. The code sets the application to xlCalculationManual and then calculates the selected cells ten times to get a more consistent response.
The new, non-indirect code clocked in at 35ms versus 75ms for the old code. I was kind of surprised to see that because the old code only uses the cells that it needs, whereas the new code is a little more lax re its coverage. However indirect AND address ("where the fifth parameter (the sheet_name) is given") are single-threaded functions which may be the reason for the performance hit.
My next post will explain the new "FastSuperNeighborhood"; stay tuned.
The original "SuperNeighborhood" formula was:
The new "FastSuperNeighborhood" formula is:
I prototyped diagnostic VBA code to calculate the columns and return the execution time. The code sets the application to xlCalculationManual and then calculates the selected cells ten times to get a more consistent response.
The new, non-indirect code clocked in at 35ms versus 75ms for the old code. I was kind of surprised to see that because the old code only uses the cells that it needs, whereas the new code is a little more lax re its coverage. However indirect AND address ("where the fifth parameter (the sheet_name) is given") are single-threaded functions which may be the reason for the performance hit.
My next post will explain the new "FastSuperNeighborhood"; stay tuned.
Comments
Post a Comment