I'm no excel guru, but I think I made it work on a sheet I modified. First, I added two new columns so that there is both a Buy and Sell DM for BOTH the origin world and the destination. It was easy enough to change where the visible part of the spreadsheet pointed to and isolate the two so the codes for the correct world are being used for selling and buying as appropriate.
Then I looked at the trade code modifiers and there were only two fields with potential negative modifiers. I changed both of them to check for negative modifiers and use them before getting the max of the positive numbers
Common Consumables BUY: =IF(N3,-4,MAX(IF(N2,3,0),IF(N19,2,0),IF(N7,1,0)))
Radioactives SELL: =IF(N2,-3,IF(N15,-2,MAX(IF(N11,3,0),IF(N9,1,0))))
For the issues I was seeing, that fixed it for me, but as you said earlier, there are other implications for the changes. I just wanted to share what I'd done in case it proved helpful.
.
EDIT: Because only having one roll for buying AND selling was bugging me bad, I added a separate cell for the selling roll and then referenced it in the sales price chart. It was easier than I expected and now one calculation gets buying and selling in one go with appropriately different results for the ORG and DEST.