Use Excel VBA to perform A/B testing for conversion
A/B testing, also known as split testing, is a statistical method used to compare two versions of a variable to determine which one performs better. Widely employed in fields like marketing, product design, and website optimization, A/B testing empowers organizations to make data-driven decisions.
At its core, A/B testing is about experimentation. The process involves dividing a target audience into two groups: Group A, which is exposed to the existing version (the control), and Group B, which interacts with the new variant (the test). The objective is to observe how these groups respond and to measure the performance difference between the two versions.
The foundation of A/B testing lies in its randomized assignment of participants to ensure that the results are not biased by external factors. Furthermore, clear and measurable key performance indicators (KPIs), such as click-through rates, conversion rates, or time spent on a webpage, are used to evaluate success.
I have studied A/B testing in Python, but decided to study it in Excel because more people know how to use excel than python. I have decided to write a program in Excel VBA that will carry out an A/B test if the user inputs the requested information, being:-
- Criteria for group A
- Criteria for group B
- Number of instances for group A
- Number of instances for group B
- Number of conversions for group A
- Number of conversions for group B
- The significance level, or alpha
When the user opens the page for the A/B test, he will find a blank page with a button on the upper right side of the page. When the user clicks the button, the program in VBA will be activated:-
The user will be prompted to enter the seven pieces of information, and the below data will appear on the worksheet. (Note, the example below is to test whether a website should be green coloured or blue coloured.)
The code for this program can be seen below:-
I have created a video to accompany this blog post and it can be found here:- https://youtu.be/0Or4M4BX0Y4
