IP Programming – objective function ist not a function BUT a table

Here is a short description of my problem:

Part of my objective function is not a regular function. Instead it’s a table.

You can see a short extract here:

enter image description here

So if the height is smaller or equal to 300 and the length is between 301 and 345 (including 345) the price is p2.

My first idea was to create a boolean variable:

enter image description here

So i can add sth like this to my objective function:

enter image description here

Next step is to create two other boolean variables, one for, wenn the height is matching row r, and one for the length:

enter image description here

So when both of them are 1, y_r is also 1:

enter image description here

But how do i create constraints that can switch h_r and l_r to 1 if they are fitting the row r ?

I found a smiliar question here, but its not quite it. I´m not sure, if I have upper and lower bonds and what they are if so.

Thank you for your help!