Google Sheet Link
First sheet is for generating the output in the second sheet. You can see there is no referencing currently. I included a couple minor notes in the first sheet.
The challenge is how to achieve the same output in the most efficient, yet simplest way possible based on input...