Forum Discussion
ashunjoy_1911
Sep 03, 2020Copper Contributor
Excel- Split a number
Dear Sir, I am facing problem in excel for splitting a number into different random parts Like I want to split 45 into 7 random parts "1st part between 0-12" " 2nd part between 0-12" " 3rd ...
- Sep 03, 2020
Dear Dr. Sharma
Please find a file that has a VBA script.
input your number in cell A1 (for example 45)
the function will use randbetween... until the sum will be 45
if you want 55, just change the value in cell A1
best regards
PReagan
Sep 03, 2020Bronze Contributor
Hello ashunjoy_1911,
I'm not sure that I fully understand your problem. It could be possible that not all 7 parts are random. For example, say random numbers of the first 5 parts were 12, 10, 12, 5, 6. The sum would already be 45 and thus the final 2 parts must be 0. This would make the final two parts non-random as they are dependent on the sum of the previous parts.