+ Reply to Thread
Results 1 to 9 of 9

Distribute Numbers

  1. #1
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Distribute Numbers

    Hi,

    How can I distribute 1 numbers for each cell when the maximum Last row is met and need to go back to 1?

    I have 7 numbers, need it to distribute in 5 persons.

    People 1 = 1
    People 2 = 1
    People 3 = 1
    People 4 = 1
    People 5 = 1

    Now need to go back to People 1 to add 1 then People 2 to add 1 also.

    People 1 = 2
    People 2 = 2
    People 3 = 1
    People 4 = 1
    People 5 = 1

    How can I do this in a VBA macro distributing numbers,

    Output of the spreadsheet will be this:

    A B
    1 People 1 2
    2 People 2 2
    3 People 3 1
    4 People 4 1
    5 People 5 1

  2. #2
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Distribute Numbers

    You should be able to do this without a macro. If your people are listed in column A and your magic number (7) is in D1, then paste the formula below in B1 and fill down through B5:

    =INT($D$1/COUNTA($A$1:$A1000))+IF(ROW()<=MOD($D$1,COUNTA($A$1:$A1000)),1,0)

    Using a formula will give you automatic updates if you need to change your magic number.

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Distribute Numbers

    Try this for names in "A".
    Change Constant "Num" to suit.
    Please Login or Register  to view this content.
    Regards Mick

  4. #4
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Distribute Numbers

    To: MickG

    Im getting an error:

    "Application defined or object defined"

    I just need to tweak the code in my need.

    The Names are listed in Column I. It has 5 names. Then I have a value that needs to be divided to them 5. Thats why I need a code, would just like to ask some more help on my errors, here is my code.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Distribute Numbers

    To: MickG

    Im getting an error:

    "Application defined or object defined"

    I just need to tweak the code in my need.

    The Names are listed in Column I. It has 5 names. Then I have a value that needs to be divided to them 5. Thats why I need a code, would just like to ask some more help on my errors, here is my code.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Distribute Numbers

    If you data is basically like this:-
    Please Login or Register  to view this content.
    Then this is the code:-
    Please Login or Register  to view this content.
    Regards Mick

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Distribute Numbers

    If you data is basically like this:-
    Please Login or Register  to view this content.
    Then this is the code:-
    Please Login or Register  to view this content.
    Regards Mick

  8. #8
    Forum Contributor
    Join Date
    04-22-2013
    Location
    Philippines
    MS-Off Ver
    Office 365, Excel 2016
    Posts
    146

    Re: Distribute Numbers

    It was so amazing.. Now works fine for me! Thank you so much.. that was exactly I am looking for. Thank you.

  9. #9
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Distribute Numbers

    You're welcome

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Distribute numbers in array
    By safetboy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-29-2016, 01:53 AM
  2. [SOLVED] Distribute given numbers in an array without repeating
    By safetboy in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 01-08-2016, 05:49 PM
  3. Distribute numbers into buckets
    By targus92 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-01-2015, 07:31 PM
  4. Distribute Numbers
    By shimaa01234 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-13-2014, 05:24 AM
  5. Evenly distribute numbers
    By captain118 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-05-2013, 01:27 AM
  6. Assign and distribute 1,2 or 3 to a range of numbers
    By etaf in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-23-2013, 11:57 AM
  7. Distribute dates by week numbers
    By excel90 in forum Excel General
    Replies: 4
    Last Post: 09-28-2010, 07:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1