Started working on reference column on the left

I can't seem to figure out a specific part of the code logic.  Will
continue tomorrow...
Not sure why it doesn't work, but I'll stop

I have to take a break from this, spent the past two days on this
constantly.