adding new rows based on column value

khabouri

New Member
Joined
Sep 17, 2017
Messages
1
hi there
well yesterday i had add power query for my Microsoft excel 2010, so i am really new to this. so my question is that power query can add columns, but no rows? unless if we add column then we pivot it, but even adding columns has to be manual, i mean i dont know yet how to make an automatic formula.
in my scenario i have the following data

IDDescriptiontypecat.number
A-001alphaacat.11
C-003deltaacat.22
C-004betaccat.15

<tbody>
</tbody>

now the "number" represents how many time is data copied for the represented row.
so what i am trying to achieve first is as follow:

IDDescriptiontypecat.number
A-001alphaacat.11
C-003deltaacat.21
C-003deltaacat.22
C-004betaccat.11
C-004betaccat.12
C-004betaccat.13
C-004betaccat.14
C-004betaccat.15

<tbody>
</tbody>

so is there a way to go to power query advance and add a formula to make this automatically?

thank you in advance and best regards
Khabouri
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
After 1 day experience with Power Query it is way too soon to draw conclusions about what would be (im)possible.
Please bear in mind that Power Query is built on a complete programming language ("M"), so just assume for now that anything is possible until proven otherwise.

I created table Data in Excel and the query below for your requirements. You can create a new blank query, go into the Advanced Editor and replace the default code with the code below.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", type text}, {"Description", type text}, {"type", type text}, {"cat.", type text}, {"number", Int64.Type}}),
    TransformedToLists = Table.TransformColumns(#"Changed Type", {{"number", each {1.._}, type {Int64.Type}}}),
    #"Expanded number" = Table.ExpandListColumn(TransformedToLists, "number")
in
    #"Expanded number"
 
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,993
Members
448,539
Latest member
alex78

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