Building a list from table

Luin29

New Member
Joined
Oct 7, 2015
Messages
45
Hello everyone,

I would like some help writing a code that will take a table I use and turn it into a list.

I would like to take this current table:

Well ID8260B7199314.0
MW-1C--11
MW-2B1--1
MW-3A----1

<tbody>
</tbody>

And alter it so that it will look like this:

Well IDTest
MW-1C7199
MW-1C314.0
MW-2B8260
MW-2B314.0
MW-3A314.0

<tbody>
</tbody>

In short: Create a row for each well and each test.

I have spent some time writing a few lines of code (which will copy, paste, and delete rows of data to achieve the final product) but I would like to see if anyone has other ideas (I am currently researching how to perform this task through the use of setting up a dictionary but am not sure how it would work if I was to use the same code on a different table that had more test).

Any and all help is greatly appreciated.

Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
you can try PowerQuery

Well ID8260B7199314.0Well IDAttribute
MW-1C--
1​
1​
MW-1C7199
MW-2B
1​
--
1​
MW-1C314.0
MW-3A----
1​
MW-2B8260B
MW-2B314.0
MW-3A314.0

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Well ID"}, "Attribute", "Value"),
    #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Value"})
in
    #"Removed Columns"[/SIZE]
 
Last edited:
Upvote 0
Excel 2010/2013 PowerQuery add-in
Excel 2016/365/2019 PowerQuery aka Get&Transform built-in
 
Upvote 0

Forum statistics

Threads
1,215,528
Messages
6,125,342
Members
449,218
Latest member
Excel Master

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