Feb 27 2022 04:19 PM
Hi, I'm new to the forum and hope this question makes sense. I have a spreadsheet with financial information that I use to prepare my tax return. The rows are different securities. The columns are different types of income (eg interest, dividends, capital gains, etc.). For each security, I enter appropriate data in the relevant columns. I'd like to create a view - or a report - that would show each security, with related income types and data underneath the security name. In essence, I'm trying to convert the column data into horizontal rows under the security name. Any ideas how I could accomplish this?
Feb 27 2022 11:39 PM
Hi @guywe
according to your description, this sounds like a perfect task for Power Query. You would need to load your table into Power Query and there is a transformation type called "unpivot columns".
In your example, you would select the column with the securities and then upply the transformation "Transform | Unpivot Columns | Unpivot other columns"
This will convert all the other columns into rows.
Feb 28 2022 12:37 AM
@guywe Excel for the Mac, unfortunately, does not support the feature described by @Martin_Weiss yet. But if you are an MS365 subscriber or have Excel 2021 you could use a LAMBDA function to unpivot the data for you. It's demonstrated in K3 in the attached file. I picked it up from @PeterBartholomew1 no too long ago and tweaked it a little bit. Perhaps you can use it on your own data and create the reports you need from this tabular (unpivotted) data.
Feb 28 2022 03:20 AM
Hi Riny
If you are getting involved with Lambda functions, would you like to see some utilities I have experimented with? One reads a data item from an arbitrary representation of a multidimensional array, using the Lambda function
Feb 28 2022 03:25 AM
@PeterBartholomew1 Will study with great interest!!
Feb 28 2022 07:47 AM
Thanks @Martin_Weiss . I think this approach should work, although still need to navigate my way through this! (I believe Power Query functionality is indeed available to me as a MS365 subscriber). Appreciate the guidance - thanks again!
Feb 28 2022 07:53 AM
Feb 28 2022 08:02 AM
@guywe PQ is NOT available on the Mac to the extent that you need it. You can connect to a workbook or a TXT/CSV file and import them. That's it. No more PQ functionality, unless you dive into quite cumbersome VBA solutions. Nothing you would want to get involved with, I believe. And you don't really need to understand the LAMBDA. It works like a regular function. The only difference is that the "function" exists only in the workbook as a named formula.
=UNPIVOT(data_range, column_header, row_header)