VBA vs. Python: What Is Better for Data Analysis?

Whenever we talk about data analysis, Excel and VBA are the first tools that come into an average person’s mind. However, Python has been growing rapidly for the last couple of years with the rise of machine learning and artificial intelligence. As a data analyst, it’s essential to compare these two languages and know which one is better for data analytics.

Python is better than VBA for data analysis because it is more powerful and cleaner. Data analysis using Python also provides better version control. VBA is only suitable for simple Excel automation as it’s built for that. If you want to do anything more complex, you are better off using Python.

Even though Python is the modern choice, knowing why many professionals still use VBA will allow you to appreciate and even use it for certain things. Read on to learn all about data analysis using VBA and Python.

Important Sidenote: We interviewed numerous data science professionals (data scientists, hiring managers, recruiters – you name it) and identified 6 proven steps to follow for becoming a data scientist. Read my article: ‘6 Proven Steps To Becoming a Data Scientist [Complete Guide] for in-depth findings and recommendations! – This is perhaps the most comprehensive article on the subject you will find on the internet!

What Is VBA?

The full form of VBA is Visual Basic for Applications. It is a language developed for Microsoft Office programs like Excel, Word, Outlook, PowerPoint, etc. VBA is essentially an implementation of the Visual Basic programming language developed by Microsoft in the ’90s. The VB language was developed to allow Microsoft programs to communicate with each other.

Excel is the most common spreadsheet for computers. It is user-friendly and comes preinstalled with newly purchased PCs. We can efficiently perform various calculations, and the program has a group of statistical functions as well. Creating spreadsheets to calculate monthly budgets, track associated expenses, and sort the data are common uses of Excel.

The reason we’ve talked about Excel is that VBA is not a standalone program; it’s a language used to automate tasks in applications like Excel. VBA provides a full code-writing environment for data analysis. You can build your own functions, automate tasks, and develop custom code. It’s been there with Microsoft Office for over 20 years.

To edit Visual Basic code, you have to access the Visual Basic Editor (VBE) by going to the Developer tab and then clicking on Visual Basic. Alternatively, you can just press Alt+F11. This editor is a complete integrated development environment (IDE) that allows you to create and edit macros and other Visual Basic code.

The Benefits of Using VBA

VBA is still very popular among Excel enthusiasts. It’s a flexible language that doesn’t get in the way of beginners, and its English-like syntax makes it easy to learn. The language is very similar to C# but doesn’t have a steep learning curve. Although it’s quite an old language and can get clunky, some people still prefer using VBA for many Excel tasks.

Why does VBA still have favorable reviews? Why would you want to learn it? Let’s answer these questions by looking at the top three advantages of using Visual Basic for Applications.

It Can Automate Tasks Really Well

The remarkable ability to automate Excel processes and tasks is what makes VBA so useful. It can eliminate the need to repeat activities and replace them with macros and visual controls. Anything you can do in Excel can be automated. In fact, you can do stuff that you wouldn’t even think was possible!

VBA lets you repeatedly execute tasks in precisely the same way without making any mistakes. It also performs the tasks much faster than you can do it manually. With the help of VBA, you end up saving a lot of time and avoiding many errors.

It Is User-Friendly

Microsoft created VBA to go along with its applications, so the code is very intuitive. There are no curly braces or long phrases to memorize. You simply write what you want to do, and that’s it. For example, consider this line of code: Range(“A1:C7”).ClearContents. Anyone familiar with Excel can make an educated guess that this code tells Excel to clear every cell’s contents from A1 to C7. 

This user-friendliness of the VBA code makes it easy to use. Even people with no programming experience can teach themselves to understand and write VBA code with little effort.

It Has a Large User Community

VBA has been around for quite a long time, so there’s a lot of documentation and help forums to assist you with anything you want to do. It is also Microsoft’s introductory language, so it has a strong and large community.

If you plan on learning VBA and Excel by yourself, you’ll find this to be a great advantage since debugging errors is a major part of self-teaching. There are forums like Mr. Excel, where you can get solutions to your questions even in a matter of minutes.

The Downsides of VBA

Microsoft is planning to replace VBA with JavaScript. Now, it’ll be at least 10-15 years before VBA becomes irrelevant and the company stops supporting it. Still, it proves that Microsoft itself would prefer something other than VBA. There will be no exciting new functionalities or capabilities released in this language. 

VBA is great for a lot of things, but it lacks some object-oriented-programing features like Inheritance. It’s essential to keep in mind these cons to help you decide between VBA and Python. Here are some more disadvantages of using Visual Basic for Applications:

It Has a Bad Reputation

Since VBA is not an industrial-strength language, the developer community doesn’t hold it in high regard. Apart from the lousy error-handling of VBA, it also lacks a well-developed class library. The VB editor is also outdated and simply terrible. It feels like the editor is actively working against writing object-oriented VB code.

In Stack Overflow Development Survey 2020, VBA remains the “most dreaded” language among developers. It has been this way for a few years now. Before VBA, in 2018, the most dreaded language was Visual Basic 6.0, which is essentially the same as VBA. So it’s evident that developers don’t consider VBA to be a “real” programming language.

It Is Restricted to Office Applications

As we’ve said, VBA is not an independent language. It can only run within a host application and never as a standalone program. This language is heavily integrated into Excel and other Microsoft Office programs, which can be both a good and a bad thing.

It’s good that other people don’t need any extra software except for Excel to use your macros. However, it also limits VBA’s functionalities as you can only use it within the domain of Excel. You cannot manipulate other programs or web apps with VBA. Compared with other languages used for data analytics—namely, Python and R code—it’s a disadvantage that VBA is restricted to Office applications.

What Is Python?

Python is a high-level, general-purpose programming language that’s also flexible and open-source. It has been rapidly growing in popularity because of its ability to handle a wide range of tasks. Its syntax uses English keywords, making it effortless to read and understand. That’s why Python is very beginner-friendly and easy to get started with.

Since Python is becoming more and more popular, the demand for good Python developers is also skyrocketing. This, in turn, means that the salary for Python development jobs is also increasing. Many large tech companies like Instagram, Facebook, Google, and Pinterest use Python in their applications. It proves that Python is a robust and reliable programming language and indicates that it is also the language of the future.

As we’ve said, Python is a general-purpose or multi-purpose language. It means that, unlike domain-specific languages, Python can be used for a variety of applications. For example, we can use HTML and CSS only for building and designing web pages. However, we can use Python for web development, software development, mobile app development, and more. It has broad application, but in this article, we’ll only discuss how Python is used for data analysis.

The Benefits of Using Python

There are good reasons why Python is one of the most commonly used programming languages. It offers powerful libraries out of the box and is used by giant corporations, which means it can handle large amounts of data with ease. Understanding Python’s pros will help you compare it with VBA and just get an idea of what the Python world is like. So here are the major benefits of learning Python for data analysis:

It Is Easy to Learn

Python is beginner-friendly, and you’ll find it easy to get started with it. Its syntax is concise, and reading Python code is much like reading English, making it easy to learn and understand. For example, you will have to construct a class just to print “hello world” in Java, while Python can do the same in one line of code with a simple print statement.

Python is the most straightforward programming language that you can learn, compared to other programming languages available today.

It Comes With Powerful Packages

Python has an extensive library that contains code for various purposes like web browsers, image manipulation, databases, email, unit-testing, and more. These excellent libraries make it insanely easy to do complex data analysis and machine learning tasks.

If we talk specifically about data science, Python has NumPy for fundamental scientific computing, Pandas for data manipulation and analysis, Matplotlib for data visualization and plotting, Seaborn for statistical data visualization, and several more powerful libraries.

It Is Open-Source

As you probably already know, Python is freely available to download. Not only that, but it’s also open-source. This means you can download Python’s source code, make changes to it, and distribute the altered version of Python. This can be useful when you want to reuse the code and save some time building new applications. Developers can also change Python’s behavior and use its older versions for development.

It Is Well-Supported

You’re bound to face problems regardless of the programming language you use. Fortunately, lots of developers use Python. In 2020, it took the top spot for the fourth year in a row for the “most wanted” programming language in the Stack Overflow Developer Survey. 

The language is also used in industrial and academic circles. So there’s a massive community behind Python, and you can always turn to Stack Overflow, documentation, or user-contributed code for help.

The Downsides of Python

No programming language is perfect. Python also shares its portion of cons, which should be considered before investing your time—and perhaps even money—into learning Python programming. Here are some disadvantages of Python:

Its Memory Consumption Is High

Python has flexible data types, so memory consumption is higher in Python than in other languages. This means Python is not the right choice for any memory-intensive tasks. Also, for any project, you’ll need to track the memory consumption carefully. You will also have to follow the best coding practices to avoid potential memory problems.

It Can Be Slow

As we’ve discussed, Python is an interpreted language. It means Python code is executed by taking the instructions directly instead of compiling it into machine-language instructions. This behavior can often result in slower execution time.

To understand this better, take C language, for example. It is a compiled language, so it doesn’t spend as much time examining the source code and rapidly converts it into CPU instructions. Therefore, code written in the C language executes faster than Python.

It Is Dynamically Typed

Usually, for data science purposes, developers prefer a statically typed programming language as it can reduce many bugs in your system. But since Python is a dynamically typed language, it requires more testing. It can also have errors that show up at runtime only.

It Is Simple

No, I’m not kidding. The simplicity of Python can actually be harmful. It is easy to learn, and its clean and concise syntax also makes it easy to read and understand. This makes programmers get accustomed to Python so much that they feel the code of harder languages like Java is unnecessary.

This “disadvantage” isn’t really the fault of the language. We, humans, prefer simple stuff, so more people are naturally drawn to Python than other languages that might be more complex.

VBA vs. Python for Data Analysis: Which Is Better?

We’ve considered both languages individually—what they are, their pros, and their cons. Now it’s time to discuss in detail which of these languages is better for data analysis. But before we do that, let’s review the fundamental similarities and differences between the two languages.

Both Python and VBA are high-level, interpreted languages. The former is a general-purpose language, while the latter is a domain-specific language. Python is also open-source, which means it allows people to change the source code in creative ways. On the contrary, VBA is proprietary to Microsoft, which means it is not open-source and cannot be edited.

So, is VBA dead, and should Python be used for all purposes? Or is VBA still better than Python since it comes integrated with Excel?

For anyone wanting to get into data analytics, Python is the preferred language. VBA is not recommended for aspiring data analysts. As we’ve discussed, Python’s popularity has been growing for the last few years and will continue to grow in the future. Plus, Python also has tons of extremely helpful libraries for all purposes such as – machine learning, data analytics, web development, etc.

One of the major reasons why Python is preferred over VBA is because Python integrates well with other programs. You can import and export various kinds of file formats into Python. Its code is also reproducible and compatible, and it handles large data sets much better than VBA. On your path to learning and using Python, you’ll find plenty of tutorials and forums to help you find your way out of errors and deepen your knowledge.

Once you’ve learned the basics of Python, you can learn a library designed for data analysis like Pandas. Python is beginner-friendly, and you shouldn’t have any major issues learning it. But if you do, there are many free and paid resources available on the internet to help you out. You’ll find lots of excellent tutorials on platforms like YouTube, freeCodeCamp, Coursera, etc.

Back to the debate, is Python always better than VBA for data analysis? Well, both languages perform their tasks well. So it’s not that VBA is awful and should be avoided at all costs. You can still use it for many functions within Excel, like copying workbooks, forecasting sales and earnings, creating invoices and forms, and saving time on any repetitive Excel task by creating a macro for it.

Author’s Recommendations: Top Data Science Resources To Consider

Before concluding this article, I wanted to share few top data science resources that I have personally vetted for you. I am confident that you can greatly benefit in your data science journey by considering one or more of these resources.

  • DataCamp: If you are a beginner focused towards building the foundational skills in data science, there is no better platform than DataCamp. Under one membership umbrella, DataCamp gives you access to 335+ data science courses. There is absolutely no other platform that comes anywhere close to this. Hence, if building foundational data science skills is your goal: Click Here to Sign Up For DataCamp Today!
  • MITx MicroMasters Program in Data Science: If you are at a more advanced stage in your data science journey and looking to take your skills to the next level, there is no Non-Degree program better than MIT MicroMasters. Click Here To Enroll Into The MIT MicroMasters Program Today! (To learn more: Check out my full review of the MIT MicroMasters program here)
  • Roadmap To Becoming a Data Scientist: If you have decided to become a data science professional but not fully sure how to get started: read my article – 6 Proven Ways To Becoming a Data Scientist. In this article, I share my findings from interviewing 100+ data science professionals at top companies (including – Google, Meta, Amazon, etc.) and give you a full roadmap to becoming a data scientist.


While both Python and VBA have their pros and cons, people usually side with one or the other.

Python is preferred over VBA, mainly because it’s a future-proof language. VBA is also restricted to Office applications, while Python can easily integrate with other software programs and even other programming languages. 

If you want to get into data analysis, you should learn Python and a few libraries designed for data analysis. If you are a heavy Excel user, VBA can be a useful skill that’ll save you a tremendous amount of time and effort. 

BEFORE YOU GO: Don’t forget to check out my latest article – 6 Proven Steps To Becoming a Data Scientist [Complete Guide]. We interviewed numerous data science professionals (data scientists, hiring managers, recruiters – you name it) and created this comprehensive guide to help you land that perfect data science job.

  1. Corporate Finance Institute. (2020, October 24). Transitioning from Excel to Python – Overview, benefits. https://corporatefinanceinstitute.com/resources/knowledge/other/transitioning-from-excel-to-python/
  2. Domain-specific language. (2004, March 11). Wikipedia, the free encyclopedia. Retrieved November 20, 2020, from https://en.wikipedia.org/wiki/Domain-specific_language
  3. Ferguson, A. (n.d.). A history of computer programming languages. Brown University Department of Computer Science. https://cs.brown.edu/~adf/programming_languages.html
  4. General-purpose programming language. (2004, August 11). Wikipedia, the free encyclopedia. Retrieved November 20, 2020, from https://en.wikipedia.org/wiki/General-purpose_programming_language
  5. Inheritance (object-oriented programming). (2001, December 20). Wikipedia, the free encyclopedia. Retrieved November 20, 2020, from https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)
  6. Language implementation. (n.d.). https://www.radford.edu/~nokie/classes/380/Chap1-Lang-Impl.html
  7. Learn Python for data science. (2020, May 26). Edureka. https://www.edureka.co/blog/learn-python-for-data-science/
  8. (n.d.). Matplotlib: Python plotting — Matplotlib 3.3.2 documentation. https://matplotlib.org/
  9. MrExcel message board. (n.d.). MrExcel Message Board. https://www.mrexcel.com/board
  10. (n.d.). NumPy. https://numpy.org/
  11. (n.d.). pandas. https://pandas.pydata.org/
  12. Stack overflow developer survey 2020. (n.d.). Stack Overflow. https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages-dreaded
  13. Terra, J. (2019, March 5). Python for data science and data analysis. Simplilearn.com. https://www.simplilearn.com/why-python-is-essential-for-data-analysis-article
  14. Visual Basic for applications (VBA) definition. (n.d.). Investopedia. https://www.investopedia.com/terms/v/visual-basic-for-applications-vba.asp
  15. What is the difference between a compiled and an interpreted program? (2018, January 18). Indiana University Knowledge Base. https://kb.iu.edu/d/agsz
  16. Why is Python slower than other languages? (n.d.). RxJS, ggplot2, Python Data Persistence, Caffe2, PyBrain, Python Data Access, H2O, Colab, Theano, Flutter, KNime, Mean.js, Weka, Solidity. https://www.tutorialspoint.com/why-is-python-slower-than-other-languages
  17. Wu, J. (2019, December 3). Python’s advantages and disadvantages summarized. Medium. https://medium.com/better-programming/pythons-advantages-and-disadvantages-summarized-212b5fdf8883

Affiliate Disclosure: We participate in several affiliate programs and may be compensated if you make a purchase using our referral link, at no additional cost to you. You can, however, trust the integrity of our recommendation. Affiliate programs exist even for products that we are not recommending. We only choose to recommend you the products that we actually believe in.


Daisy is the founder of DataScienceNerd.com. Passionate for the field of Data Science, she shares her learnings and experiences in this domain, with the hope to help other Data Science enthusiasts in their path down this incredible discipline.

Recent Posts