You are here:

Excel/Formulas in cells vs VBA


Hello Damon,

My workbook has 5 worksheets that contain 500 rows by 15 columns of formulas. ALL the cells in each row are left unused until a value is entered into column "A" ex. "A1". Then one row is calculated, when a value is entered into A2 then row two is calculated. etc.

Is it better to create VBA to do this or leave it in cell formulas?

Thank you

Hi Dave,

The word "better" is a bit subjective. Whether an approach is better depends on whether you are concerned about efficiency (calculation speed), file size, functionality (i.e., does it work the way you want it to?), simplicity (are the formulas easy to understand?), and probably other factors I can't think of.  What you describe can of course be accomplished with either formulas or VBA.

If your concern is calculation speed, unless your formulas are exceedingly complicated or very repetitive (e.g., calculating or looking up the same value multiple times in each cell) you should use worksheet formulas rather than VBA--they will almost always be faster.

If your concern is file size you should use VBA.  This is because the only overhead is the text of the VBA code, but it eliminates (in your case) 5 worksheets x 500 rows x 15 columns of formula text--which is bound to be larger.

Functionality concerns almost always give the advantage to VBA because it can provide almost any functionality you desire.  But if implementation via worksheet formulas gives you exactly the functionality you want with reasonably simple formulas, why bother with VBA?  I usually use VBA when I need to do something that is very difficult or impossible to accomplish with worksheet formulas.

I hope this answers your question.

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Damon Ostrander


I have extensive experience with VBA programming in Excel 5 through Excel 2013. As a former aerospace engineer with a large aerospace corporation and consultant in a small defense technology services company, I have developed a wide range of applications in VBA, including simulations involving mixed-language programming, satellite orbit mechanics, graphics and animation, and real-time applications. I am interested in moderate to hard VBA-related questions only.


I have developed and taught several courses in Excel VBA programming and also VBA programming in Office 97, 2000, and 2007. I have developed a number of large technical applications in Excel VBA for use within the aerospace industry.

B.S. in Electrical Engineering and Computer Science, University of California, Berkeley.

©2016 All rights reserved.