Convert single row data into multiple lines based on Qty

key3535

New Member
Joined
Dec 4, 2023
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi Guys
I am looking at the solution wherein the row data converted into multiple row based on Quantity. This is to map lot nos (unique codes) against each line item. Attached data and desired output in the file

Data:
Excel Formula:
Sales_OrgPayerNameSold toNameShip toNameReference InvoiceCountryInvoiceBilling TypeBilling DateInvoice ItemItem CategoryPurchasePlanQuantitySales UnitUnit PriceTotal ValueHSN CodeVATCGSTSGST/UGSTIGSTMax Retail PriceRebate basisCurrencyDeliveryDelivery ItemOrder NumberOrder ItemMaterialMaterial DescriptionBrandProfit centerStandard PriceCurrencyPrice UnitBase UnitStandard Price in TotalList_PriceCurrencyPrice UnitUomList Price in Total
8080​
6329365​
S PHARMACEUTICALS
6329365​
S PHARMACEUTICALS
6329365​
S PHARMACEUTICALSIN
1101139898​
F2
12/2/2023​
140​
TAN
2​
6P
1169.3​
2,338.60​
90013000​
280.63​
0​
0​
280.63​
2,190.00​
2,338.60​
INR
4030773352​
140​
8643946269​
140​
16050292​
ACUVUE OASYS 8.4 -8.50 6P RxPH
10010​
388.08​
INR
1​
6P
776.16​
1,169.30​
INR
1​
6P
2,338.60​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1101139899​
F2
12/2/2023​
10​
TAN
3​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4030773342​
10​
2065656987​
10​
16177498​
1DM ASTIG 8.5 -1.25 -2.25/10 30P Rx1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1101139899​
F2
12/2/2023​
30​
TAN
3​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4030773342​
30​
2065656987​
30​
16089060​
1DM ASTIG 8.5 -8.00 -1.25/10 30P RX1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​

Output:

Sales_OrgPayerNameSold toNameShip toNameReference InvoiceCountryInvoiceBilling TypeBilling DateInvoice ItemItem CategoryPurchasePlanQuantitySales UnitUnit PriceTotal ValueHSN CodeVATCGSTSGST/UGSTIGSTMax Retail PriceRebate basisCurrencyDeliveryDelivery ItemOrder NumberOrder ItemMaterialMaterial DescriptionBrandProfit centerStandard PriceCurrencyPrice UnitBase UnitStandard Price in TotalList_PriceCurrencyPrice UnitUomList Price in Total
8080​
6329365​
S PHARMACEUTICALS
6329365​
S PHARMACEUTICALS
6329365​
S PHARMACEUTICALSIN
1.101E+09​
F2
12/2/2023​
140​
TAN
1​
6P
1169.3​
2,338.60​
90013000​
280.63​
0​
0​
280.63​
2,190.00​
2,338.60​
INR
4.031E+09​
140​
8.644E+09​
140​
16050292​
ACUVUE OASYS 8.4 -8.50 6P RxPH
10010​
388.08​
INR
1​
6P
776.16​
1,169.30​
INR
1​
6P
2,338.60​
8080​
6329365​
S PHARMACEUTICALS
6329365​
S PHARMACEUTICALS
6329365​
S PHARMACEUTICALSIN
1.101E+09​
F2
12/2/2023​
140​
TAN
1​
6P
1169.3​
2,338.60​
90013000​
280.63​
0​
0​
280.63​
2,190.00​
2,338.60​
INR
4.031E+09​
140​
8.644E+09​
140​
16050292​
ACUVUE OASYS 8.4 -8.50 6P RxPH
10010​
388.08​
INR
1​
6P
776.16​
1,169.30​
INR
1​
6P
2,338.60​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1.101E+09​
F2
12/2/2023​
10​
TAN
1​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4.031E+09​
10​
2.066E+09​
10​
16177498​
1DM ASTIG 8.5 -1.25 -2.25/10 30P Rx1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1.101E+09​
F2
12/2/2023​
30​
TAN
1​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4.031E+09​
30​
2.066E+09​
30​
16089060​
1DM ASTIG 8.5 -8.00 -1.25/10 30P RX1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1.101E+09​
F2
12/2/2023​
10​
TAN
1​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4.031E+09​
10​
2.066E+09​
10​
16177498​
1DM ASTIG 8.5 -1.25 -2.25/10 30P Rx1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1.101E+09​
F2
12/2/2023​
30​
TAN
1​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4.031E+09​
30​
2.066E+09​
30​
16089060​
1DM ASTIG 8.5 -8.00 -1.25/10 30P RX1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1.101E+09​
F2
12/2/2023​
10​
TAN
1​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4.031E+09​
10​
2.066E+09​
10​
16177498​
1DM ASTIG 8.5 -1.25 -2.25/10 30P Rx1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​
8080​
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIES
6234682​
ABORN INDUSTRIESIN
1.101E+09​
F2
12/2/2023​
30​
TAN
1​
30P
1286.77​
3,860.31​
90013000​
463.23​
0​
0​
463.23​
2,410.00​
3,860.31​
INR
4.031E+09​
30​
2.066E+09​
30​
16089060​
1DM ASTIG 8.5 -8.00 -1.25/10 30P RX1MA
10031​
583.5​
INR
1​
30P
1,750.50​
1,286.77​
INR
1​
30P
3,860.31​
Excel Formula:
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Using Power Query and assuming your Excel table is called Table1, you could use the following code:

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Added Custom" = Table.AddColumn(Source, "RepeatedRow", each {1..[Quantity]}),
    #"Expanded RepeatedRow" = Table.ExpandListColumn(#"Added Custom", "RepeatedRow"),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded RepeatedRow",{"RepeatedRow"})
in
    #"Removed Columns"
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

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