This is something I needed to do today and wondered if anyone had a more elegant solution:
I had a range of cells, which were in the shape of a box, like this:<style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr><td>d</td><td>e</td><td>c</td><td>d</td></tr> <tr><td>i</td><td>f</td><td>g</td><td>b</td></tr> <tr><td>a</td><td>j</td><td>k</td><td>h</td></tr></table>
I needed to transform the cells into a column and sort them to look like this:<style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr class="tableizer-firstrow"><th></th></tr> <tr><td>a</td></tr> <tr><td>b</td></tr> <tr><td>c</td></tr> <tr><td>d</td></tr> <tr><td>e</td></tr> <tr><td>f</td></tr> <tr><td>g</td></tr> <tr><td>h</td></tr> <tr><td>i</td></tr></table>
The way I did it was to first transform the range into a column by using the INDEX function and manually putting in the row/number that I needed, like this: <style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr class="tableizer-firstrow"><th>row</th><th>column</th><th>letter</th><th>formula</th></tr> <tr><td>1</td><td>1</td><td>d</td><td>=INDEX($A$1:$D$3,A6,B6)</td></tr> <tr><td>1</td><td>2</td><td>e</td><td>=INDEX($A$1:$D$3,A7,B7)</td></tr> <tr><td>1</td><td>3</td><td>c</td><td>=INDEX($A$1:$D$3,A8,B8)</td></tr> <tr><td>1</td><td>4</td><td>d</td><td>=INDEX($A$1:$D$3,A9,B9)</td></tr> <tr><td>2</td><td>1</td><td>i</td><td>=INDEX($A$1:$D$3,A10,B10)</td></tr></table>
Then I sorted this column after getting all of the letters into a column.
But... is there a more elegant solution?
I had a range of cells, which were in the shape of a box, like this:<style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr><td>d</td><td>e</td><td>c</td><td>d</td></tr> <tr><td>i</td><td>f</td><td>g</td><td>b</td></tr> <tr><td>a</td><td>j</td><td>k</td><td>h</td></tr></table>
I needed to transform the cells into a column and sort them to look like this:<style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr class="tableizer-firstrow"><th></th></tr> <tr><td>a</td></tr> <tr><td>b</td></tr> <tr><td>c</td></tr> <tr><td>d</td></tr> <tr><td>e</td></tr> <tr><td>f</td></tr> <tr><td>g</td></tr> <tr><td>h</td></tr> <tr><td>i</td></tr></table>
The way I did it was to first transform the range into a column by using the INDEX function and manually putting in the row/number that I needed, like this: <style type="text/css">
table.tableizer-table {border: 1px solid #CCC; font-family: Arial, Helvetica, sans-serif; font-size: 12px;} .tableizer-table td {padding: 4px; margin: 3px; border: 1px solid #ccc;}
.tableizer-table th {background-color: #104E8B; color: #FFF; font-weight: bold;}
</style>
<table class="tableizer-table">
<tr class="tableizer-firstrow"><th>row</th><th>column</th><th>letter</th><th>formula</th></tr> <tr><td>1</td><td>1</td><td>d</td><td>=INDEX($A$1:$D$3,A6,B6)</td></tr> <tr><td>1</td><td>2</td><td>e</td><td>=INDEX($A$1:$D$3,A7,B7)</td></tr> <tr><td>1</td><td>3</td><td>c</td><td>=INDEX($A$1:$D$3,A8,B8)</td></tr> <tr><td>1</td><td>4</td><td>d</td><td>=INDEX($A$1:$D$3,A9,B9)</td></tr> <tr><td>2</td><td>1</td><td>i</td><td>=INDEX($A$1:$D$3,A10,B10)</td></tr></table>
Then I sorted this column after getting all of the letters into a column.
But... is there a more elegant solution?