I am looking to use the sumif function for to sum the values of the codes between a specific full range.

I have simplified this example, but the information comes from an accounts code structure. It is an I&E with an slighly unstructured coding format.

I have a list of codes column A, and a list of values column B.

A B
1 50
2 150
3 200
4 150
5 149
6 132

I want to add up all of column B, between the range 2 to 5.