Formula to reverse column orders and align

joshaer

New Member
Joined
Apr 11, 2014
Messages
15
Hi,

I have data that looks like this:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]a[/TD]
[TD]b[/TD]
[TD]c[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]g[/TD]
[TD]c[/TD]
[TD]d[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]h[/TD]
[TD]i[/TD]
[TD]d[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]d[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

and I need a formula to convert it to look like this:


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]d[/TD]
[TD]c[/TD]
[TD]b[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]d[/TD]
[TD]c[/TD]
[TD]g[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]d[/TD]
[TD]i[/TD]
[TD]h[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]d[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

(i.e. the order reversed, and the last values (as per first table) all in the same column).

If it helps, the letters represent individuals, and the chain is the reporting chain (i.e. "d" is CEO of the organisation, so eventually every employee ends up reporting to "d". The challenge is that it's through different length strings.

For each individual, I have a unique ID and a unique ID for their manager. I assemble the top table by looking up the manager ID in the list of employee IDs and returning the associated manager ID (i.e. manager's manager) and so on until I get to the end ("d"). I then need to work out how to turn this around into the opposite structure, where all the "d"s are in the same column.

As I will have to hand this over to multiple people, there is a very strong preference not to use any VBA.

Thanks!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
This works for your example data:

=IFERROR(INDEX($A1:$D1,1+COUNTA($A1:$D1)-COLUMNS($A1:A1)),"")
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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