learning-excel-vba-and-python
learning-excel-vba-and-python
Chris McHugh
November 5 th , 2020
Learning to use applications and programming languages has to be a hands-on experience. Books
can be useful as a reference to show you fundamental tasks or perhaps suggest ways of doing things
that you were previously not aware of. However, nobody would trust a surgeon to operate if they
had only read about it in a book so practical experience is necessary.
Excel is the most commonly-used tool for manipulating numerical data. Using the
application requires an ability to navigate the menu options, use formulae and some of the
special functions. It requires virtually no programming knowledge but it does require
learning the correct syntax (i.e. formula structure) for the various functions.
VBA is a fantastic entry-level programming language that sits behind all the Microsoft
applications although it is most heavily used for Excel. VBA forms an interesting bridge
between Excel and programming because you can record Macros in Excel and see the
programming output generated in VBA. This is a great way to learn – you can then reverse
this and change the VBA programs to direct Excel how to behave. Once you supplement this
with some additional fundamental programming tools (eg. loops, functions) you will have
really started to learn programming.
Python is a popular programming language used for numerical work and machine science and is very
flexible. However, it does have a more demanding syntax and is less forgiving than VBA so it is
harder to learn as a first language. In order to use Python, you need to have an interface to write
programs. Web-based tools are available, although installing dedicated software to write, save and
run programs is a more robust option (known as an IDE - Integrated Development Environment). A
well-used version called ‘Spyder’ is a good starting point that is available free from the Anaconda
open-source ‘individual’ distribution (see ‘Sample Resources – Python’ below).
There are many free resources you can use to get started – some of these are shown below.
In addition, while you are working, you will discover many sites on the internet that explain
how to solve particular issues if you perform an internet search. You will often find this
quicker than trying to look something up in a book. Videos are also available and can be a
useful alternative.
1
Last update: July 2022
Example searches
• “Excel how to use a pivot table”
• “Excel how to format graph axis”
• “Excel how to count the number of workdays between two dates”
• “Excel vba how to write a loop”
• “Python how to generate a list of random numbers”
Sample Resources
Excel
Excel videos (fundamentals):
https://support.microsoft.com/en-us/office/excel-video-training-9bc05390-e94c-46af-a5b3-
d7c22f6990bb?ui=en-us&rs=en-us&ad=us
Introduction to Excel
https://www.excel-easy.com
VBA tutorials
Introduction to VBA
https://www.excel-easy.com/vba.html
Python
Anaconda/Spyder Installation
https://www.anaconda.com/products/individual
2
Last update: July 2022