I have the following array formula in my spreadsheet, however when I sort the data the reference 'Portable Register'!C7 acts like an "absolute" reference even though there is no $ $ in it, and ends upreferring to the wrong row.

{=MAX(IF('Completed Runs'!$D$4:$D$741='Portables Register'!C7,'Completed Runs'!$G$4:$G$740))}

Is there a trick to sorting array formulas?