I needed a single formula (not a Button) to transpose the Rows and Columns of a table.
How It Works
each line explained…
The resulting display is the contents of the Original table with the rows and columns transposed
This is awesome!
Thank you so much for all of your contributions to the community. Your posts are always so insightful and are true gems for Coda enthusiast.
ok… i looked at my code and realized it was twice as long and complicated as needed.
so i have reduced it to a more manageable minimal set of code.
here is the result (as before, its a ‘virtual’ transposed table - display-only)
and here is the shorter formula…
How It Works line-by-line
This runs faster, has less moving parts, and is easier to follow.
Someone asked why the _Code()? it shows the cells in a fixed-width font. otherwise the width of each cell would be slightly different and they would not align properly.
@Xyzor_Max, one would think I no longer would be surprised by all the gems you publish, and yet, one’d be wrong.
This is incredible, thank you SO much for so generously sharing your findings with the community.
In order to make your wondeful contribution accessible to as many interested readers as possible, I have taken the step-by-step overview you included and broke it down into displaying the formula results for each step.
It helped me much faster understand what your code does, and I’m thinking it might serve the same purpose for others.
I’m sharing the doc in an fully editable view, so that everyone can peek inside the formula editor - please do make sure not to delete anything, as this would sour the experience for others.
Max, what a community champion you are, indeed. Thanks so much for all you do for our Coda community!
All the best from Austria,
you did a great job breaking it down, explaining it well, and displaying all the intermediate results.
Recently, I was searching for a way to dynamically represent data in a virtual table (that is, moving from a “one-to-many” relationship to a “one-to-one” relationship without the user having to press a button to achieve this.
@Xyzor_Max graciously took the time to share his wisdom with me on how to best achieve this. The second thing he said once I finally cracked it (after “Congrats!”) was “Now you must share your solution with the community”. And, as is usually the case, he was right of course. So, here goes:
Imagine we want to schedule a team retreat. While the scheduling is under way, we want to dynamically keep track of the number of times each team member interacts with every team member.
That is, we want to dynamically visualize Interactions Scheduled, ie how often does each team member meet with every other team member?
We will create the virtual table in the following two ways:
And here are the formulas used (I decided to include a static header, as well as a static side-bar, to ensure that the 2D-Matrix could easily be read by the user)
And to display as colored circles, simply add a “Switch-If” to the formula to display a green circle to represent the value 1, a yellow circle to represent the value 2, etc.
Yet again I needed a sinple formula to display a TABLE in a TRANSPOSED format (ie swap rows and cols)
And I found an even SIMPLER solution…