Can anyone offer code to solve this problem?

I am hoping to find a simple code or even a function to include in excel to figure out this problem below, any ideas are welcomed and please keep in mind that I am a newbie.

I am not sure what a correct term would be (so if you know, please tell me), but I will describe the situation. There is a total number of people from the list that must be selected, each person costs X and will produce Y. I want to be able to list many people with their cost(X) and production(Y) to offer the maximum total production(Y) for a total cost(X) which stays within the limits given.

Example, 3 people must be selected from below and the total cost must be 10.0 or less.

Person A costs 8 and will produce 10

Person B costs 7 and will produce 9

Person C costs 6 and will produce 15

Person D costs 3 and will produce 9

Person E costs 2 and will produce 5

Person F costs 1 and will produce 3

Person G costs 1 and will produce 1

in this example Person C, D and F total 10 and will produce 27.

I hope the way I am explaining this is correct and if anyone can offer any sort of help with this, I really look forward to hearing from you, thank you in advance.

Alan