Not sure I've understood exactly what you're after, but I'll take a crack.
Add an extra column to the end of the spreadsheet. (Let's say it's column CZ for argument's sake)
Set the formula in that, to derive the thing you want to filter on.
So, for cell CZ2 (assuming row 2 is the first row of data), the formula might look something like:
=if(L2="",H2,L2)
which would take the value from column L wherever there is a value there; and the value from column H otherwise. You could also extend the IFs and do lookups into other sheets, to handle the cases where some values get replaced by others.
Then filter on your new column CZ.