+ Reply to Thread
Results 1 to 31 of 31

Split a number equally to multiple cells

  1. #1
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Split a number equally to multiple cells

    Hello,

    I want to divide a number to different cells, in every cell max value must be 100.

    For example:

    A1 value is :220

    B1: 100
    B2: 100
    B3:20


    How can I do that ?

  2. #2
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Split a number equally to multiple cells

    Paste this into cell B1:

    Please Login or Register  to view this content.
    and this into cell B2:

    Please Login or Register  to view this content.
    And drag down to fill.

    Will something like that work?
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  3. #3
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Split a number equally to multiple cells

    B1: =IF(LEN(A1)=3,100,0) doesnt work, formula has error

  4. #4
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,077

    Re: Split a number equally to multiple cells

    Quote Originally Posted by mcmahobt View Post
    Paste this into cell B1:

    Please Login or Register  to view this content.
    and this into cell B2:

    Please Login or Register  to view this content.
    And drag down to fill.

    Will something like that work?
    If the original number is less than 100 this doesn't work (though I couldn't come up with a solution so well done!)
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,077

    Re: Split a number equally to multiple cells

    Maybe that should be

    in B1
    =IF(LEN(A1)=3,100,A1)

  6. #6
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Split a number equally to multiple cells

    Good catch Special. That should work if the value is <100, but the formula will not work if the value is also >=1000. Still haven't found a concise workaround for that.

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: Split a number equally to multiple cells

    B1=if(row(a1)<=ceiling(a$1/100,1),min(a$1-(row(a1)-1)*100,100),"")
    try this and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  8. #8
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,077

    Re: Split a number equally to multiple cells

    Quote Originally Posted by nflsales View Post
    B1=if(row(a1)<=ceiling(a$1/100,1),min(a$1-(row(a1)-1)*100,100),"")
    try this and copy towards down
    Works on > 100 and < 100 but not if > 1000
    though op hasnt specified the range the original number will take

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,380

    Re: Split a number equally to multiple cells

    Rather than doing this as a text string, I would probably do this as an algebra type problem.

    Technically, there are an infinite number of ways to divide up a number into parts that add up to the whole. The approach you seem to want will count how many 100's there are in the number, then add on the remainder after that many 100's. Algebraically: y=n*100+x. (For exactness, we will say that n is an integer and n and x are both positive.
    n can be found from the INT function n=INT(y/100)
    x can then be found from the original function x=y-n*100

    At this point, is it sufficient to know what n is, or do you need to make n copies of 100 into n cells?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,939

    Re: Split a number equally to multiple cells

    =IF((ROW(A1)-1)*100<A$1,MIN(100,A$1-(ROW(A1)-1)*100),"")
    can try this too

  11. #11
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,652

    Re: Split a number equally to multiple cells

    B1: =MIN(100,A1)
    B2: =MIN(100,$A$1-SUM(B$1:B1))
    From B3 to Bx pull formula B2 down
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  12. #12
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,077

    Re: Split a number equally to multiple cells

    Quote Originally Posted by popipipo View Post
    B1: =MIN(100,A1)
    B2: =MIN(100,$A$1-SUM(B$1:B1))
    From B3 to Bx pull formula B2 down
    Same problem if > 1000 though

  13. #13
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,652

    Re: Split a number equally to multiple cells

    max value must be 100.
    This is what TS ask for
    So I dont see the problem.

  14. #14
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,077

    Re: Split a number equally to multiple cells

    OP needs to define range of numbers

  15. #15
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,652

    Re: Split a number equally to multiple cells

    B1: =min(10^(len(a1)-1);a1)
    b2: =min(10^(len($a$1)-1);$a$1-sum(b$1:b1))

  16. #16
    Registered User
    Join Date
    05-10-2013
    Location
    Pomáz, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Split a number equally to multiple cells

    Put in B1 and copy down:

    =IF(ROW()<=$A$1/100,100,IF($A$1-(ROW()-1)*100>0,$A$1-(ROW()-1)*100,""))

  17. #17
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Split a number equally to multiple cells

    I tried your advices but formulas has error they didnt work.
    let me be more specific, I want to make a capacity plan but I couldnt work it out. I decided to ask to gurus so I am here

    what I am tryin to do:
    capacityplan.xlsx
    *ignore 5000* typo


    - how can i auto skip weekends?
    - how split main amount to daily max. 900 capacity?
    - and is it possible to fill a color automatically like i did manually in file?

  18. #18
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,652

    Re: Split a number equally to multiple cells

    I don't see the logic in it.

  19. #19
    Registered User
    Join Date
    05-10-2013
    Location
    Pomáz, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Split a number equally to multiple cells

    For me the formula in post #16 does what you wanted. What differences do you experience?

  20. #20
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,652

    Re: Split a number equally to multiple cells

    Take a look at this
    Attached Files Attached Files

  21. #21
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Split a number equally to multiple cells

    Quote Originally Posted by popipipo View Post
    Take a look at this

    popipipo thats exactly what i am trying to do as logic. awesome.

    is it possible to fill same color the values belongs to same amount ? like in my example file
    Last edited by zottiri; 01-12-2015 at 03:41 PM.

  22. #22
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Split a number equally to multiple cells

    Quote Originally Posted by István Hirsch View Post
    For me the formula in post #16 does what you wanted. What differences do you experience?
    Istvŕn I tried your formula, excel says there is a mistake on formula.

  23. #23
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,652

    Re: Split a number equally to multiple cells

    With conditional format you can get the colors
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    05-10-2013
    Location
    Pomáz, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: Split a number equally to multiple cells

    Quote Originally Posted by zottiri View Post
    Istvŕn I tried your formula, excel says there is a mistake on formula.
    VsVtV.jpg

    Does your Excel use „;” or „,” as argument separator?

  25. #25
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Split a number equally to multiple cells

    As long as the number isn't a negative number...

    Data Range
    A
    B
    1
    Value
    Increments
    2
    1132
    100
    3
    100
    4
    100
    5
    100
    6
    100
    7
    100
    8
    100
    9
    100
    10
    100
    11
    100
    12
    100
    13
    32
    14
    15
    16
    17
    18
    19
    20


    This formula entered in B2:

    =MIN(A2,100)

    This formula entered in B3:

    =IF(A$2<=SUM(B$2:B2),"",MIN(100,A$2-SUM(B$2:B2)))

    Copy down until you get blanks
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  26. #26
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Split a number equally to multiple cells

    Quote Originally Posted by popipipo View Post
    With conditional format you can get the colors
    Can you make example for 1 color ?

  27. #27
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,652

    Re: Split a number equally to multiple cells

    Sorry, it was the wrong file
    Attached Files Attached Files

  28. #28
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Split a number equally to multiple cells

    thanks a lot to all of you for your help, especially popipipo

  29. #29
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Split a number equally to multiple cells

    @ zottiri

    You can mark you thread solved.

    How?
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Note:
    You can also thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given.
    By doing so you can add to the reputation(s) of those who helped and shared their time in helping you.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  30. #30
    Registered User
    Join Date
    01-12-2015
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Split a number equally to multiple cells

    I did !

  31. #31
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Split a number equally to multiple cells

    Nice. Surely next time member's are very much willing to help.
    Just never forget to hit their star's to thank them all.

+ 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. Replies: 8
    Last Post: 05-21-2014, 07:51 AM
  2. Split 1 Cell Value(Numeric) into Various Cells Equally
    By waqas331 in forum Excel General
    Replies: 3
    Last Post: 02-14-2014, 03:24 AM
  3. dividing data equally between cells VBA
    By lauro in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-06-2014, 10:16 AM
  4. Macro which sums up equally colored cells
    By Marina86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2013, 08:40 PM
  5. Split rows equally in columns
    By cooksterni in forum Excel General
    Replies: 1
    Last Post: 06-26-2011, 10:46 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