Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Tranpose row into column and shift row down

I have an Excel file with this data format.

enter image description here

Now I want to transform those data into column, like this.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

How should I do that with Excel Formula or VBA scripts?

I have tried using Transpose paste but it overwrites the rows underneath.

>Solution :

Using Excel Formulas it can be accomplished like as below:

enter image description here


• Formula used in cell A6

=HSTACK(TOCOL(IFS(B2:E4<>"",A2:A4),3),TOCOL(B2:E4,1))

Also I had prefer using POWER QUERY. To achieve this using the said procedure, follow this simple steps using POWER QUERY window UI:

enter image description here


  • First convert the source ranges into a table and name it accordingly, for this example I have named it as Table_1

  • Next, open a blank query from Data Tab –> Get & Transform Data –> Get Data –> From Other Sources –> Blank Query

  • The above lets the Power Query window opens, now from Home Tab –> Advanced Editor –> And paste the following M-Code by removing whatever you see, and press Done

let
    Source = Excel.CurrentWorkbook(){[Name="Table_1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"SKU"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value", "Images"}})
in
    #"Renamed Columns"

enter image description here


  • Lastly, to import it back to Excel –> Click on Close & Load or Close & Load To –> The first one which clicked shall create a New Sheet with the required output while the latter will prompt a window asking you where to place the result.

enter image description here


Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading