This can be done through an Index match statement (I did something similar recently), however how to write it has currently escaped me.