+ Reply to Thread
Results 1 to 3 of 3

Thread: copy cell value until the sum=100

  1. #1
    Registered User
    Join Date
    10-27-2011
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    1

    copy cell value until the sum=100

    I have numbers in column A, which sums up to a total of say 450. Now, I want to copy the values of A1 to B1, A2 to B2 and so on until the sum of column B is 100. Then the remaining cells will have number 0. So at the end, cells in column B will either have the same value as in the corresponding cell of Column A, or will have a zero but ONE cell will have a non-zero value which is less than the corresponding cell in column A (to keep the sum of B to be 100).

    Can someone help me to write a formula for this?

  2. #2
    Valued Forum Contributor MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5,300

    Re: copy cell value until the sum=100

    Hi ssrao and welcome to the forum,
    Find the attached with the answer. It looks like:
    =IF(SUM(B$1:B1)=100,0,IF(SUM(B$1:B1)+A2>100,100-SUM(B$1:B1),A2))
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * below to say thanks.

  3. #3
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,592

    Re: copy cell value until the sum=100

    And another way!

    Change the value in B1
    Attached Files Attached Files
    Last edited by Marcol; 10-27-2011 at 09:47 PM.
    If you need any more information, please feel free to ask.

    However, if this takes care of your needs, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED. It helps everybody! ....
    Also
    If you are satisfied by any members response to your problem please consider using the small Star icon botom left of thier post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0