I am playing a fantasy NBA game where I have to put together a team of players comprising of the following positions, PG, PG, SG, SG, SF, SF, PF, PF, C and stay under a salary cap of $100,000. So I have a spreadsheet separated out by position tabs. In each tab, I list players who play that position, the expected number of fantasy points, and their salary.

I want to build the team of players that will give me the most amount of expected fantasy points while still staying under the salary cap. The only way I can think to do this is to write some kind of script that will try every possible combination of players. I can do this in a database but I was wondering if there is a way to do it in excel.

Anyone have any ideas?