Random distribution formula

is there a formula that will divide a number randomly between a given number.      
      
So lets say I have 10 clients and 35 widgets.      
      
I want to distribute the widgets across the 10 clients randomly.      
      
so       
      
Client 1      gets 4
Client 2      gets 0
Client 3      gets 3
Client 4      gets 2
Client 5      gets 1
Client 6      gets 1
Client 7      gets 3
Client 8      gets 6
Client 9      gets 8
Client 10      gets 7

Thanks in advance
JagwarmanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try this..
28695867.xlsm
JagwarmanAuthor Commented:
thanks Ryan only this is I was looking for formula rather than vba. The above was an example and so potentially the number of Clients will be a moving target. i.e. I put 10 in example but in live there could be 20 or 70 or 35 or 100 etc.

Regards
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Ok, so you may customize this sample instead.
28695867-b.xlsm

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Rgonzo1971Commented:
HI,

Or you could use a UDF returning an array see example

Function RandomWidgets(nrWidgets) As Variant
Dim Res() As Integer
    With Application.Caller
        CallerRows = .Rows.Count
    End With
    ReDim Res(0 To CallerRows - 1)
    Randomize
    For i = 1 To nrWidgets
        rIdx = Rnd * Now() Mod CallerRows
        Res(rIdx) = Res(rIdx) + 1
    Next
    RandomWidgets = Application.Transpose(Res)

End Function

Open in new window

Regards
28695867V1.xlsm
JagwarmanAuthor Commented:
I like that and it's flexible
Rob HensonFinance AnalystCommented:
Fomula driven, for first client, in G4:

=RANDBETWEEN(0,B1)   where B1 has number of widgets

For remaining clients G5 down, against list created manually in column A:

=IF(A6="",$B$1-SUM(G$4:G4),RANDBETWEEN(0,$B$1-SUM(G$4:G4)))

Checks if last client and takes balancing figure other wise takes Random value between remainder and zero.

Thanks
Rob H
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.