Working with Combinations/Probability in Excel - excel

Working an a project with many more possible combinations and I'm not sure how to approach it, so I'm going to ask how to do it on a smaller scale and then apply it to a larger scale.
I have to buy 1 of product A and 1 of product B
They both come in 100 varieties at different prices.
For product A:
TABLE 1 (A1:B6)
Dollars-Versions
1-15
2-20
3-30
4-20
5-15
and Product B
TABLE 2 (C1:D6)
Dollars-Versions
1-40
2-30
3-20
4-5
5-5
I know the minimum I can spend is $2 (600 combinations) & the Max is $10 (75 combinations), and there are 10000 (100x100) total combinations
If I put the dollar values 2-10 in cells E2:E10, is there a formula to quickly determine the number of combinations for each net dollar value in cells F2:f10?
I imagine it would have to be done with an sumif array formula, but I can't start to figure out what it would be. If I had a small data set like this, I would make a crosstab, but my data set is too large to do it efficiently.
Thank you in advance!

You would need a formula like this:-
=SUM((A$2:A$6+TRANSPOSE(C$2:C$6)=F2)*B$2:B$6*TRANSPOSE(D$2:D$6))
which would have to be entered as an array formula using CtrlShiftEnter
It builds up a 2D array with ones at the elements where the corresponding cells in the two lists add up to the amount you have to spend, then multiplies it by the corresponding numbers of combinations.

Related

Average using excel formulas

hope it's been a good holiday.
Had a question regarding excel, that can best be phrased through an example.
I have a table which has 4 columns and 2 rows. in the each of the 4 inputs in row 1, we have a $ amount our company has (100000, 150000, 200000, 175000), and in row 2 we have the amount of product which we've been able to purchase, note: this products doesn't have a fixed price, and is constantly changing. Row 2 has the values (10000,20000,22000, 18000 respectively for the above $ amounts).
I want to have a cell, where if I input the dollar amount, I have, it will give me the average amount of product I can buy based on the historical data. Also, I need the formula to be dynamic, i.e once I add a fifth column, it takes the average using 5 datapoints, instead of the previous 4.
Thanks for any help, was having problems uploading an excel to display this, so hope this suffices.
I tried various look up/index formulas with no luck.
You want FORECAST.LINEAR():
=FORECAST.LINEAR(C6,2:2,1:1)

generate all possibilities from two fixed rows of entries?

I spent hours trying to look for a solution and I feel like I got close but figured asking would be the best way.
Lets say I have a table with 2 columns, column A is an item, and column B is a price for the item. This table has 12 entries. What I would like to do is generate additional tables of 6 entries that do not exceed a certain price. see below for example. The number i want these table to not exceed is 50,000.
for example the first entry could be an apple at 9,000 value. the apple is column a, and value column b.
Can someone help with a way to generate all combinations of 6 items from column a, that do not exceed a combined price of 50,000 in column b?
With 12 items you have 212-1 or 4095 possible combinations of products. These can map into the 12 bits of a 12-bit binary number. It is not difficult to write a macro to calculate the total cost of each combination and then filter the result to display results less than or equal to 50,000.
EDIT#1:
Please see:
Best possible combination sum of predefined numbers that smaller or equal NN
Listing all possible combination without repetition,VBA

How to create four equal buckets of decimal values

I have an excel table:
JobA .03445
JobB .01366
JobC .93271
JobD .6335
Plus 65,000 more.
What I need to do, is to create four equal buckets based on the values. where the sum of all Jobs in each bucket come as close to the other three buckets as possible.
Is there a way to do this in Excel?
Thanks
You can try this approach based on the incremental percentage. So you sum each incremental job until your sum reaches 25% of total values (that is BucketA), jobs from 25-50% will be "BucketB", 50-75% "BucketC", and rest will go into "BucketD". Sum of values in each bucket should be pretty close since you have 65k of values.
enter this formula
=IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.25,"BucketA",IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.5,"BucketB",IF(SUM($B$2:B2)/SUM($B$2:$B$100000)<0.75,"BucketC","BucketD")))
in cell C1 and drag it to the bottom.
There's lots of studies into algorithms that solve these types of problems. Your problem is actually the exact same format as the equal piles example in this article:
https://simple.wikipedia.org/wiki/P_versus_NP#Example
Considering the volume you're working with and the fairly narrow range of values, you could get a fairly good approximate solution by simply doing this:
Sort all items in descending order by value
In an adjacent column, put 1, 2, 3 and 4 against the first 4 values.
Use autofill to repeat that pattern against all values
You should now have 4 groups of fairly equal value

Taking the top values and averaging from data list in Excel

I have a data list in Excel, I am looking to take the top 3 values for each number, and get the average for those 3 values quickly. I often work with lists of up to 50,000 lines which at any one time could convert to over 10,000 different column A numbers.
I understand basic pivot tables to get an average after the top 3 values are collected, but need to find a way to remove all values that are not the top 3,
I trust this may be an extremely simple ask, or complex and thank you in advance for your help.
you can use =LARGE(Array, k) formula. For example, =LARGE(B:B, 1) is for 1-largest number, =LARGE(B:B, 2) is for 2-largest number etc.
If column contains many duplicates, and you want to get all occurences of top three values, use this formula to get all of them (put:
=IF(LARGE(B:B,ROW(A1))>=LARGE(B:B,COUNTIF(B:B,LARGE(B:B,COUNTIF(B:B,MAX(B:B))+1))+COUNTIF(B:B,MAX(B:B))+1),LARGE(B:B,ROW(A1)),"")

I'm trying to calculate the average with multiple columns (days and firms) and rows

I'm currently trying to calculate the following:
That is, the average daily sales of a firm. The example underneath is small, but in reality I have 280 days and over a 100 firms. I've tried with VLOOKUP(firmname A, (cells), sales) but it obviously only brings back one number. Sum(Vlookup) is also not the best of choice.
Anyone who could point me in the right direction ... SUMIF?
http://i66.tinypic.com/2wmnrbn.png
Assuming data is located at B2:C11 and the list of Firms is at F2:F5 enter this formula in G3 and copy till last record
=AVERAGEIFS($D$3:$D$11,$C$3:$C$11,$F3)

Resources