how I can divide a sum number into 50 column in ecxel? - excel

I would like to tell, with a smaller number of columns.
Let's say we have a sum of 24 and we want to distribute it randomly into 10 separate columns. we should get such a result as below I wrote.
Is there a formula in Excel like this?
Thanks in advance.

Ok. Here is what I would do...
For each required split, select a random number between zero and the remainder of the distribution qty, multiplied by the percentage of how many splits have already been calculated. This prevents the first few splits being very high, and the rest being zero.
I would also add a check for the very last split to make sure that it equals whatever is left of the original distribution qty.
Here is an image for illustration and the formula that I have used:
=IF($A2=MAX($A:$A),$F$1-SUM($B$1:$B1),RANDBETWEEN(0,($F$1-SUM($B$1:$B1))*($A2/MAX($A:$A))))
Hopefully, this isn't too complex to understand. If you need further explanation, please let me know.
You can simply change the distribution qty in the yellow box, and if you want more splits, all you need to do is drag down columns A & B to the required number.

Related

What function to use for this difficult excel calculation for the roulette wheel?

so I am a complete excel and math noob and I want to have a cell in excel which will display the "Pelayo number", which is used in calculating bias in a roulette wheel. You can read more about it here: https://www.roulette-bet.com/2015/06/the-roulette-bias-winning-method.html
enter image description here
Let me explain briefly what I want. As you can see on the image there are two columns, in one there are the numbers on a roulette wheel and and in the second one there is the frequency of each number. On top you see number of spins (852). The number on the bottom (23,02.....) is the expected frequency of each number. The table is dynamic, constantly evolving as I enter new data.
Now I want a cell to display the total number of positives. Which is calculated like this:
If there have been 300 spins, each numbers has to have been spun 300/36 = 8.33 in order to be breaking even. This means those which have been spun 8 times are losing a little, and those which have showed 9 times are winning something. If a number has appeared 14 times it is clear it has 14-8.33 = 5.67 which we will express in an abbreviated form like +5. Let’s suppose the exact same situation has occurred for 6 other numbers also, they all will make a total sum of 5.67 + 5.67 + 5.67 + 5.67 + 5.67 + 5.67+ 5.67 = 39.69. as no other number has been spun over 9 times, then we say the amount of total positives at this table at 300 spins is +39.
TLDR So ideally something like: Select all the numbers from (G6:G42) which are bigger than value in (G50) and then substract them one after another from the expected frequency (G50) and then add this all up.
I tried to solve it but just couldnt find a tutorial anywhere
I'll break this down for you, and show you a few helpful Excel concepts along the way.
Especially if you are a beginner, I'd recommend using a helper column. Helper columns are great ways to break down complicated functions into smaller, more manageable parts.
In H6, write =IF(G6>G$50,G6,0). That if statement will set us up for our sum, with either the value in G6 or a 0. The $ will be cleared up in a moment.
Then, hover your mouse over that cell, and a little square box will appear in the lower right corner of H6. Grab that tiny box, and drag it down to H42. This fills in the formula, adjusting all of the numbers relatively as you go. Note that the 50 stayed constant, however - that's what the $ did!
H6 is now your helper column. It doesn't find your answer, but it gets an important, intermediary step done.
Finally, wherever you'd like your answer, write =SUM(G6:G42), and you should be well on your way.
=SUMIF(G6:G42,">"&G50,G6:G42)-COUNTIF(G6:G42,">"&G50)*G50
It sums values that are over in G50 then distracts G50 value as much times as there were values to sum up to.
For example in case G50 is 23.02 and you have values 20, 21, 22, 23, 24, 25.
It would calculate like (22+23+24+25)-4*23.02

Split total by percentage and receive the same result

This is a little bit complicated to describe, but I will try my best. I have a total, let's say 1000. Then I want to split it by percentages, position count is all the time different. So there can be 3 or 70 or 130 positions or whatever. Then split sum should correspond to target value.
Here is an example of the case:
I input names under Customer request
I enter percentage for position under Percentage
In amount calculation I use =CEILING($C$5*C10;10) and in all the rest of the cells the same to get numbers look nice. It is working fine but he problem is that now totals does not match. It should end up in 15550 but after calculating totals after split it is 15660.
Is there any ideas what kind of master artificial intelligent formula can do the trick to produce nice looking numbers, taking in consideration to match Total (target) in the end if Total (calculated) percentage is 100%?
P.S. Any ideas are welcomed as well. The target is to have nice looking, rounded numbers that will sum in the same number as target - total.
Since you are using CEILING, your output number (e.g. 15660) is guaranteed to be greater than or equal to your input number (e.g. 15550). This is because any time a "perfect match" isn't found, it rounds up.
My first suggestion is to instead use ROUND instead of CEILING. Right off the bat this will perform better than CEILING because ROUND can round up or down but CEILING can only round up.
E.g. try this:
= ROUND($C$5*C10,-1)
Since you provide no details as to "how" the data needs to be adjusted to meet your input value, I can't really provide any automatic solution.
One manual solution is that you can make a new column which indicates whether the data was rounded up or rounded down, and you can adjust the percentages manually to get the data you're looking for.
Here's a formula to tell you if the data is rounded up or down (e.g. put formula in cell E10 and drag down):
= CHOOSE(SIGN(D10-($C$5*C10))+2,"Round Down","Perfect Match","Round Up")
You can use this information to manually tweak your percentages. For example... if your output value is too high, you can slightly decrease some of the higher percentages that "Round Up" and slightly increase some of the lower percentages (e.g. if you have 10% and 3%, maybe change them to 10.1% and 2.9% to see if that makes a difference.)

Excel Sumif, Sumifs with partial strings in multiple columns?

So this is the simplified question I broke down from a former question I had here: Excel help on combination of Index - match and sumifs? .
For this one, I have Table1 (the black-gray one) with two or more columns for adjustments for various order numbers. See this image below:
What I want to achieve is to have total adjustments for those order numbers that contain the numbers in Total Adjustment column in the blue table, each of which will depend on the cell beside it.
Example: Order number 17051 has two products: 17051A (Apple) and 17051B (Orange).
Now what I want to achieve in cell C10 is the sum of adjustment for both 17051A and 17051B, which will be: Apple Adjustment (5000) + Orange Adjustment (4500) = 9500.
The formula I used below (and in the image) kept giving me error messages, and this happens even before I add the adjustment for Orange.
=SUMIF(Text(LEFT(Table1[Order Number],5),"00000"),text(B10,"00000"),Table1[Apple Adjustment])
I have spent the whole day looking for a solution for this and didn’t even come close to find any. Any suggestion is appreciated.
Assuming your headers always have the text "adjustment" in them, you could use:
=SUMPRODUCT((LEFT($B$4:$B$7,5)=B10&"")*(RIGHT($C$3:$F$3,10)="adjustment")*$C$4:$F$7)
In C10 you could add two sumproducts. This assumes that products are always 5 numbers long at the start. If not swop the 5 to use the length of the product reference part you are matching on.
=SUMPRODUCT(--(1*LEFT($B$4:$B$7,5)=$B10),$D$4:$D$7)+SUMPRODUCT(--(1*LEFT($B$4:$B$7,5)=$B10),$F$4:$F$7)
Which with table syntax is:
=SUMPRODUCT(--(1*LEFT(Table1[Order Number],5)=$B10),Table1[Apple Adjustment])+SUMPRODUCT(--(1*LEFT(Table1[Order Number],5)=$B10),Table1[Orange Adjustment])
Using LEN
=SUMPRODUCT(--(1*LEFT(Table1[Order Number],LEN($B10))=$B10),Table1[Apple Adjustment])+SUMPRODUCT(--(1*LEFT(Table1[Order Number],LEN($B10))=$B10),Table1[Orange Adjustment])
I am multiplying by 1 to ensure Left, 5 becomes numeric.

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)),"")

Resources