Measuring Efficiency of Formulas and Macros

Written by Allen Wyatt (last updated March 30, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


2

Jerry notes that there are usually several ways to get the same results in Excel, such as various combinations of functions or VBA code. He knows there are some general guidelines for improving the efficiency of Excel workbooks, but notes that database designers have tools to measure and improve the efficiency of the queries that are run against their databases. Jerry wonders if there is any kind of similar tool an Excel user can use to measure the performance of a particular formula or macro to make the workbook calculate more efficiently.

There are many ways to go about improving the efficiency and calculation speed of your worksheets and your macros. The traditional method (at least when it comes to macros) is to insert some code that notes the start time of what you want to measure and then, after that code block is done, note the end time. By comparing the two you can find the elapsed time for that block and if it is unacceptable, focus your efforts on improving the algorithms in that block.

When it comes to actual formulas in a worksheet, you can't really measure elapsed time in the same way you can in a macro. All you could do (if you chose to do so) is to measure how long, overall, a recalculation took. Unfortunately, that doesn't help you narrow down what formulas you might need to change or how you might reorganize your worksheet.

If you want some tools that are more automated, you might consider purchasing Professional Excel Development, a book by Rob Bovey, Dennis Wallentin, Stephen Bullen, and John Green. This book was written some time ago, but is still (for my money) the indispensable reference for the topic. It is a formidable book (over 1,100 pages), but it includes some serious discussions about how to make your worksheets and macros as fast-performing as possible.

Another tool that is highly recommended is one called FastExcel, an add-in that helps you speed up your workbooks. It includes profiling tools to measure timing and identify bottlenecks, among other features. It is available here:

https://www.decisionmodels.com/FastExcelV4.htm

Finally, Microsoft has published an excellent article on improving the performance of your workbooks. You can find it here:

https://docs.microsoft.com/en-us/office/vba/excel/concepts/excel-performance/excel-improving-calculation-performance

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10984) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Easily Extending Selections

The F8 key is a shortcut that allows you to turn on Word's extend mode. This mode is used to "extend" the text being ...

Discover More

Finding the Previous Work Day

Excel has a number of functions that are available as an add-on in the Analysis ToolPak. One of these functions allows ...

Discover More

Nifty Zooming with the Mouse

Want to use the mouse to control the zoom level for your document? You can do it by combining your mouse use with the ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Selecting a Suggestion with the Keyboard

Excel tries to anticipate what you want to type into a cell, particularly when it comes to entering formulas. Here are ...

Discover More

Disabling a Function Key

Function keys are used to perform common tasks in Excel. If you want to disable one of the function keys, it's rather ...

Discover More

Appearance of Excel on the Taskbar

Do you want Excel to use a task button, on the Windows Taskbar, for each of your open worksheets? Then just make this ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 1?

2024-04-08 15:09:56

J. Woolley

My previous comment below described the CalcTimer macro to determine the time required to calculate a selected range of cells, the active sheet, or all open workbooks. That macro has been updated with a 4th option to determine the time required to run a specified macro.
See https://sites.google.com/view/MyExcelToolbox/


2024-04-03 12:42:32

J. Woolley

My Excel Toolbox includes the CalcTimer macro to determine the time required to calculate a selected range of cells, the active sheet, or all open workbooks. It uses a microsecond timer like the Microsoft article referenced by the Tip, but CalcTimer provides several improvements.
See https://sites.google.com/view/MyExcelToolbox/


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.