You would possibly be better off using a true database rather than Excel.
By doing this, a simple SQL query, used in conjunction with GetParameter & SetParameter would do what you want
SELECT [bars] from [table] where [pier]=pier AND [level]=level
Refer Using SQLite instead of Excel
It might seem daunting, but is really quite easy.