1

I have a (much larger) table like this sample:

Original Data

I am trying to output a table that looks like this:

Desired Outcome

The closest I can get with a pivot query returns numerical results in the value fields, rather than the desired text strings

=query(Data, "Select D,count(D) group by D Pivot B")

I resorted to a series of formulas to build my row and column headers, and then fill in the data field - See Version 3 in the sample sheet. But I couldn't figure out how to fill in the data with a single formula - as opposed to copying and pasting in the data field, which is not desirable with a dynamic number of row and column headers based on the original data.

Is there a way to wrap my data field formula (in cell B44 of the sample) in an arrayformula that will fill the data field, with a dynamic number of columns and rows?

Or even more advanced is there a formula that will deliver my desired results table in a single formula?

1 Answer 1

2

This should work, it's a bit difficult to explain, but i could demonstrate the various parts if you opened up your sheet to editable...

=ARRAYFORMULA(TRANSPOSE(QUERY(TRIM(SPLIT(TRANSPOSE(QUERY(QUERY({CHAR(10)&A2:A11,B2:B11&"|"&D2:D11&"|"},"select MAX(Col1) group by Col1 pivot Col2"),,9^9)),"|",0,0)),"select Col1,MAX(Col3) where Col1<>'' group by Col1 pivot Col2 order by Col1 desc label Col1'Project'")))
Sign up to request clarification or add additional context in comments.

6 Comments

the department sort on mine however is happening because Producing, Directing and Acting - 1,2,3 happens to be reverse alpha. I'd need to modify the formula to account for your "sort" column.
That is a remarkably brief formula. I suspect I could reverse engineer the parts. But if you wouldn't mind demonstrating it would probably be helpful for future folx who find this question.
Also, I notice that the project sort isn't quite explicitly what I am looking for, but I suspect that is not a terribly difficult change.
I forgot to say...THANKS.
@DHolcomb I put a new version on your opened-up sample sheet on the tab called Reorg_mpk. It will work for up to 9999 unique projects. More than that and it would need a small edit.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.