Populating rows based on a set criteria

excelnovice2020

New Member
Joined
May 12, 2020
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a simple table with 3 rows and 3 columns:
Column 1 - Order #, Column 2 - Part #, Column 3 - Quantity
Row 1: 123 | ABC | 5
Row 2: 456 | XYZ | 7
Row 3: 789 | OPQ | 2

How can I set up either a formula (preferably) or VBA to automatically populate, in a separate sheet:
5 rows of 123 | ABC, followed by
7 rows of 456 | XYZ, followed by
2 rows of 789 | OPQ

Thanks in advance,
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You can do this with a formula but it requires (a) a helper column and (b) knowing how far down to fill the F and G columns (or have to test for a 0). A2 is a 1 and filling down A3 which is: =A2+D2

VBA would be much cleaner.

Book1
ABCDEFG
1HelperOrder #Part #QtyOrderPart
21123ABC5123ABC
36456XYZ7123ABC
413789OP!2123ABC
515123ABC
6123ABC
7456XYZ
8456XYZ
9456XYZ
10456XYZ
11456XYZ
12456XYZ
13456XYZ
14789OP!
15789OP!
1600
1700
1800
1900
2000
2100
2200
2300
2400
2500
2600
2700
2800
Sheet2
Cell Formulas
RangeFormula
F2:G28,A3:A5F2=VLOOKUP(ROW(1:1),$A$2:$B$5,2)
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,688
Members
448,978
Latest member
rrauni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top