Saturday, March 24, 2018

yogi_ArrayFormula ( VLookup ( Query with dynamic limit clause)))

Google Spreadsheet   Post  #2404

Yogi Anand, D.Eng, P.E.      ANAND Enterprises LLC -- Rochester Hills MI     Mar-23-2018

question by: Tom Stroll!topic/docs/YamDGiRzi7k;context-place=mydiscussions

ArrayFormula ( VLookup ( Query with dynamic limit clause)))

Hey there, Happy Friday! :)

****UPDATED SIMPLER SPECS at BOTTOM**** (See my final post from March 23, 2018 )

Desired Result in Red (ColE). Orange cell F2 is the closest I got.

If a song has 3 composers and 1 publisher, the ArrayFormula would VLookup the 'Collaborators' sheet and return the 1st composer's corresponding publisher name (1 row below on the 'Collaborators' sheet) and that would be the only publisher name we see for that song. The other two would basically be filtered out by the count of publishers for that song.

HOWEVER, if a song has an equal number of composers and publishers, we would see all corresponding publisher names offset more simply by the Count of composers (grouped by that song) so that publisher names ONLY display in Rows where ColB says "Publisher" and Composer Names (Col C and D) are Blank. 

In other words the Greyed out text in ColF should not display because there are more composers than publishers for that Song b and Song e for example.

So, I'd like to replace {Collaborators!C2:D} with a Query that limits the number of Publishers per song to match the actual number of Publishers in ColB for each specific song. 

When I've tried this, I get all the same Publishers or weird offsets and errors.
ColP has all my failed ArrayFormula attempts.

NOTE: I realize Offset may be volatile with large data sets, so i'm hoping Query's limit clause can replace the need for Offset.
Maybe something like... Query(range,  "select ....  group by A  limit='"&indirect(counta())&"' "

Still, I'm using the word 'Offset' now to illustrate my point.

Thanks so much for looking into this! :)

No comments:

Post a Comment