I have a problem i cannot solve.
I'm trying to create a table that creates multiple lines per order based on the number of shipments. so for example the data i download has 2 columns, order no. and shipments.
if the shipments is more than 1 then i need a sperate line for each shipment in my new table.
I will attach a picture of what I'm trying to achieve. it has stumped me!
I've search hi and low but can't find an answer, perhaps its my clumsy wording when searching? :)
ideally i want to achieve this using formulas so data can just be copy and pasted in, thought i guess i can use vba if i must.
Assuming there is no Excel Constraints
as per the tags posted, then one could use the following formula and for the given sample this should clearly work:
=LET(α, SEQUENCE(,MAX(B3:B6)), MID(TOCOL(IF(α>B3:B6,0/0,A3:A6&" "&α),3),{1,3},{1,1}))
Or,
=LET(
α, SEQUENCE(,MAX(B3:B6)),
δ, TOCOL(IF(α>B3:B6,0/0,A3:A6&" "&α),3),
HSTACK(TEXTBEFORE(δ," "),--TEXTAFTER(δ," ")))
This can also be accomplished using Power Query
, available in Windows Excel 2010+
and Excel 365 (Windows or Mac)
and what I see it will be easier & simpler to achieve using the said tool.
To use Power Query follow the steps: (Read the steps annotations to follow)
Table_ONE
let
Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
#"Added Custom" = Table.AddColumn(Source, "Ship-ments", each {1..[shipments]}),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Ship-ments"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"shipments"})
in
#"Removed Columns"
Edit Per tags it shows Excel 2010
then can use POWER QUERY
or using helper columns with VLOOKUP()
& COUNTIF()
1
=A3+C3
and copy down till the one extra last row of your dataVLOOKUP()
in cell E3 & COUNTIF()
in cell F3=VLOOKUP(ROW(A1),$A$3:$B$7,2,1)
=COUNTIF(E$3:E3,E3)
and drag down as far as it needs to go.