I am creating a spreadsheet that models the sale of some single family homes.

I have built a sale schedule that says X of the homes are to be sold per month, and I am then looking to multiply that X number by the appropriate values (the values are not the same, and range from \$300,000-\$450,000)

Say I am supposed to sell 4 in the first month, 4 in the second month, and 4 in the last month, and the sale values are as follows:

1 – 300k

2 – 300k

3 – 300k

4 – 350k

5 – 350k

6 – 350k

7 – 400k

8 – 400k

9 – 400k

10 – 450k

11 – 450k

12 – 450k

Can I create a formula that looks at the number of homes sold in the first month (4), then add up the values 300k + 300k +300k +350k (representing the first 4 homes on the list)

The second month should be relatively similar. 4 homes are to be sold that month, however I would now like to add up home 5 – home 8 values (350k + 350k + 350k + 400k)

And for the 3rd month of 4 homes sold: 400k + 400k + 400k + 450k.

Is there a function that can dynamically add differing table values based on some type of criteria?