0

There is the table in MS Excel or LO Calc.

from this

How can be it converted to this view of the table?

to this

The transformation using links (within the same table) to the initial version is allowed.

1
  • 1
    What have you tried so far? searching for "unpivot an excel table" should lead you to many answers.
    – gns100
    Commented Aug 28, 2023 at 14:43

1 Answer 1

0

If you have Microsoft 365, you can come close with:

=TEXTSPLIT(
    TEXTJOIN(
        "|",
        ,
        SORT(
            TOCOL(
                TOROW(A2:A4) & "~" &
                    TOCOL(B1:D1)
            )
        ) & "~" & TOCOL(B2:D4)
    ),
    "~",
    "|"
)

We use the TOROW and TOCOL functions to create a Cartesian Product of the rows and columns, connecting each crossjoin by a delimiter. We then join the resultant single column with a different delimiter. Finally, we split the rows and columns using the TEXTSPLIT function.

The Formula Evaluation tool will help you see what's going on.

But, to not show the "duplicates" in the first column of output, you need to use conditional formatting using a formula to see if the content matches that of the row above. If it does, then format the font color to be the same as the background color.

enter image description here

enter image description here

2
  • Thanks. Is it only at MS Excel 365, but not at MS Excel 2013 or earlier?
    – Imyaf
    Commented Sep 1, 2023 at 8:17
  • @Imyaf That is why I wrote "...If you have Microsoft 365...". Your tags did not indicate any version restrictions. To do this in an earlier version, I suggest Power Query (Excel 2010 or later) or VBA. And it would also depend on whether you are using Windows or MAC. Commented Sep 2, 2023 at 20:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .