+ Reply to Thread
Results 1 to 12 of 12

Adjusting percentage values on cell change.

  1. #1
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379

    Adjusting percentage values on cell change.

    Good afternoon Gentlemen, I have a column of data, with a varying number of percentage values that add up to 100%, separated by "NA", i.e.

    33%
    33%
    33%
    NA
    25%
    25%
    25%
    25%
    NA
    100%
    NA
    20%
    20%
    20%
    20%
    20%
    NA

    Now... when I change one of the values I would like the others to even up, i.e. in the last example if I change a 20% to 50% I would like the others to change to 10%... any ideas?
    Last edited by ChrisMattock; 01-12-2009 at 09:49 AM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    This will work if you change the NA to blank cells:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379
    Hmm, it changes all the values, despite the fact they are now separated by "" rather than "NA". The data does noit start until Row 11, would that make a difference?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I don't know what you mean by "", but the code requires a blank cell, meaning nothing in it.

    Edit: Actually, Chris, it requires the columns on either side of the blanks to be blank as well, since that affects the vertical aspect of the CurrentRegion of a cell.

    Edit2: Post a workbook.
    Last edited by shg; 01-08-2009 at 04:29 PM.

  5. #5
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379
    That's what I meant by a blank cell, there is nothing in it.

    EDIT: I just tried it where I manually enter the percentages on a spare sheet and it works perfectly, just not on the one generated by my macro. :S

    EDIT2: Ah, is there a way round this, without putting those additional columns in?
    Last edited by ChrisMattock; 01-08-2009 at 04:34 PM.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    OK. Post a workbook.

  7. #7
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379
    Here is an example of how my output page will look, the percentages that need to auto adjust are in the Weighting Column. Thanks for the help I appreciate it.
    Attached Files Attached Files

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Code gets ugly ...

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379
    You are an absolute star. That is perfect! Thanks for your help, +rep to you!

  10. #10
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379

    Adjusting percentage values on cell change (MARK II)

    Good afternoon Gentlemen, Yesterday shg was kind enough to help with the following problem...

    I have a column of data, with a varying number of percentage values that add up to 100%, separated by "NA", i.e.

    33%
    33%
    33%
    NA
    25%
    25%
    25%
    25%
    NA
    100%
    NA
    20%
    20%
    20%
    20%
    20%
    NA

    The solution was:

    Please Login or Register  to view this content.
    Now the problem I have is that I want to adjust several of the percentages, the first one I adjust the remaining should adjust, then when I adjust the second all of them except the one I have already adjust should change... i.e.

    If I have the following

    20%
    20%
    20%
    20%
    20%

    And I change the first one...

    50%
    12.5%
    12.5%
    12.5%
    12.5%

    Then the next one I change should yield the following result

    50%
    30%
    10%
    10%
    10%

    I know this is getting complicated, any tips would be greatly appreciated!

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    04-27-2006
    Location
    Cayman Islands
    Posts
    379
    Thanks mate, that is fantastic!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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