Transpose table

I would need to display a table/view in a transposed way, with rows as columns. Is that possible?

10 Likes

+1 on being able to toggle table axes for optimized human interaction with certain data sets.

You can in a way.
You can Display as Cards and Group Cards by the first Column on the Top side.
It’s not a compact view but it can work in cases.


Hope this helps. :slight_smile:

1 Like

Good idea, but like you said, it’s just “kind of working”. Thanks!

2 Likes

Any other idea? It would be nice if we can make a formula refer by column-row.

A makeshift solution, but you can make a separate table that will look up data from your original table in a transposed way.

It will be read-only, and you’ll have to manually create row/column mappings.

Demo:

What you need to do:

  1. In the original table, introduce a formula column that will List(…) all the columns you want to be readable from your transposed table.
  2. In the transposed table, make as many columns as there are rows in the original table, and to each of them assign a formula in the fashion:
    Source.[Row as list].Nth(X).Nth(thisRow.RowId())
    where X is the constant number of this column.

Note that using RowId() is fine unless you ever delete rows from your transposed table. If you delete rows you’ll lose continuity in row IDs and will need something else as an index (e.g., a column with explicitly set values, or a row index as implemented here).

8 Likes

Thank you, that is a good suggestion and it would work for me. I see an issue with it however, and that is that if I need to do it for several tables, it’s going to be tedious.

1 Like

This Transpose problem is one that I’ve been wrestling with for awhile in the world of spreadsheets and just ran into it on Coda. I agree that this would be a really helpful function to include.

Since the @coda-team often mention that the Row in Coda is considered the smallest possible unit, it seems like that would make a Transpose function harder to accomplish than in a spreadsheet world. Following this more database-like row centric methodology, I am curious if there is a more database-friendly solution to this problem.

In Coda, is there any formula-based solution to take all items in Table 1 from a particular Column (across multiple Rows) and auto-populate those values as Column Headers in a new Table (Table 2), so that whenever another Row is added in Table 1, another Column will be created in Table 2 with a Column Header from the value of the Row in Table 1?

3 Likes

@Geoff_Strout ,nope, this would be a nice to have, but does not exist (yet).

writing a transpose function based on hard coded columns in Coda is possible but a bit of work.

best, Christiaan

I have been working on a similar project and this solution would work great for me. I have created the column (… List) but now on the transposed table, when I type source, it does not pull anything up in formulas. Am I missing something or is there another way it has to be done since its been updated?

Would like a context menu option to transform the table with a single transpose. Would just make it easier to take common excel spreadsheet data and get it into a format that works well with Coda

2 Likes

I came up with a quick and dirty way to transpose any given table:

  • Copy table (CTRL + C when table is highlighted)
  • Paste into a TSV-tranposing website such as this one
  • Copy updated text
  • Paste back into Coda

Coda handles copy and pasting of tables / columns / cells beautifully, I’d like to give them credit for that

4 Likes

Max

4 Likes

This is out of control. In the best way possible. I love it

2 Likes

Nice, sweet approach! Also a perfect use case for the column formulas I proposed

3 Likes

Once again I needed a formula to display a TABLE in a TRANSPOSED format (ie swap rows and cols)

And I found an even SIMPLER solution…

  • build a 2d matrix (list of lists) of the table columns
  • loop through each column with foreach()
  • loop through each of the col’s cells with foreach()
  • pad out the cell to a fixed size using rightpad()
  • use a fixed-width font using _code()
  • split the result into rows using bullededlist()
2 Likes

This is a cool solution! Is there a way to reference the transposed row? I have a doc which contains a profit and loss report with one column containing accounts and the others are a series of dates. I’d like to transpose it so that I can reference the rows in other formulas else where.