The purpose of this blog post is to illustrate how to create duplicate rows based on numeric values indicated for each unique row value. Consider the table below depicting status of test cases and the number of test cases which have a particular status:
We want to take the view above and create duplicate rows for each value in the “Status of Test Cases” column based on their respective numeric value in the “# of Test Cases” column (In a real life scenario doing so may be needed in order to insert a test case number for each test case). The following is what is wished to be achieved:
The traditional way of achieving the above is to insert the additional wanted rows manually. This may seem rather simple for the example above, however; imagine if we were dealing with two digit, three digit or even larger numbers. In that case inserting the extra rows manually would become a very time consuming and daunting task.
In this blog post I will teach you how to perform this task manually by utilizing Excel’s Macros function. These six steps will reach you to the desired results:
Step 1] Ensure that you Place your data in the correct columns in Excel: columns A and B respectively.
Step 2] Push “ALT+F11”
Step 3] Go to Insert > Module
Step 4] Paste the code located within the Notepad document below into the module page:
Step 5] Push "ALT+F11"
Step 6] Push "ALT+F8" and press “Run” in the window below:
Here is the end result. That was unbelievably simple!