Table Consolidation

gilbertgrape87

New Member
Joined
Apr 26, 2018
Messages
2
Hey everyone. Just wanted to started saying off by thanks! This forum has been invaluable whenever I am looking for solutions to problems.

This time though, I'm having trouble finding a good solution.

I have some poorly formatted data that I would like to be able to index, so I am trying to consolidate it.

Any ideas would be greatly appreciated! Thanks in advance!

Gilbert


Essentially, I have a table that looks like this:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD][/TD]
[TD]B
[/TD]
[TD][/TD]
[TD]C
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]X
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]X
[/TD]
[TD][/TD]
[TD][/TD]
[TD]3
[/TD]
[TD]4
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Y
[/TD]
[TD][/TD]
[TD][/TD]
[TD]3
[/TD]
[TD]4
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Y
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5
[/TD]
[TD]6
[/TD]
[/TR]
[TR]
[TD]Z
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD]4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Z
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]5
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


And I'm looking to turn it into this:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD][/TD]
[TD]B
[/TD]
[TD][/TD]
[TD]C
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]X
[/TD]
[TD]1
[/TD]
[TD]2
[/TD]
[TD]3
[/TD]
[TD]4
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Y
[/TD]
[TD][/TD]
[TD][/TD]
[TD]3
[/TD]
[TD]4
[/TD]
[TD]5
[/TD]
[TD]6
[/TD]
[/TR]
[TR]
[TD]Z
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD]4
[/TD]
[TD][/TD]
[TD]5
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Can probably just run a VBA loop, but not sure what the data looks like. Here are a couple questions.

Does the data always go consecutively in Row Headings, X1 X2 X3 then Y1 Y2, etc? Is there never overlap on the values, so X1 and X2 will never both have a value in Column "A", if there is a Value in "A" for both X1 and X2 how are you treating it? Should the blank column headers have names?
 
Upvote 0
Copy your first table to range A1:G7, and copy the second table to range A12:G15, enter the following formula in cell B13:
Code:
=IFERROR(INDEX(B$1:B$7,TEXT(SUM(($A$2:$A$7=$A13)*(B$2:B$7<>"")*ROW(B$2:B$7)),"0;;")),"")
Ctrl+shift+enter run the formula, and copy to range B13:G15.

for the list in A13:A15, the unique value of X,Y,Z you can use many way to get.
 
Upvote 0
Thanks for the responses. I'll play with that indexing statement here in a bit.

In the meantime, here's one of the tables:

https://www.dropbox.com/s/98gz8gyn9dhsvmq/Book1.xlsx?dl=0

There should be no overlapping data when the rows are consolidated. notice that there are 5 (!) columns worth of headers, those are largely redundant and currently only there to assist me in indexing. I will likely (and am certainly willing) to delete all of them except the green one, especially to assist in this manipulation.

Notice the column headers repeat for class 1, class 2, class 3, etc.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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