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!
3 Comments
Rocky
9/28/2017 03:12:38 pm
This is very awesome.
Reply
Mehran
3/25/2018 09:05:56 pm
Hi Rocky,
Reply
Mehran
3/25/2018 09:06:40 pm
http://www.mehranvahedi.com/my-blog/inserting-duplicate-rows-from-multiple-columns-based-on-numeric-values-in-a-column Leave a Reply. |
CategoriesArchives
June 2020
|