+ Reply to Thread
Results 1 to 5 of 5

Formula to return percent of change in last 2 cells at end of row

  1. #1
    Registered User
    Join Date
    05-06-2009
    Location
    Liverpool, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Formula to return percent of change in last 2 cells at end of row

    If I have a list of data from b3 to b8, for example, what formula will subtract b8 from b7 and then calculate the percentage of change and display the
    result in b2? (b1 will have a text title) Now here's the tricky part... I will constantly be adding new data and inserting it at the end of the row and the formula must adapt to always perform the calculation on the last 2 cells in the row.

    I understand the basic concept of ((b8-b7)/b8)*100 to get the percentage. What I can't do is figure out how to use functions to make sure that this operation is always performed on the last 2 cells in the row no matter how many times I add data.

    Example.. When I add a value to b9, the formula must now return results for b8 and b9. When I add to b10, it must work on b9 and b10, etc....
    Last edited by VBA Noob; 05-09-2009 at 12:58 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula to return percent of change in last 2 cells at end of row

    =(INDEX($B$3:$B$203,MATCH(9.9999E+37,$B$3:$B$203,1))-INDEX($B$3:$B$203,MATCH(9.9999E+37,$B$3:$B$203,1)-1))/INDEX($B$3:$B$203,MATCH(9.9999E+37,$B$3:$B$203,1))*100
    with 100 in b8 and 50 in b7
    will give 50
    but leave of the *100
    gives 0.5 format cell as % will give 50%
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    05-06-2009
    Location
    Liverpool, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Formula to return percent of change in last 2 cells at end of row

    Ooops! Thank-you for the response; however, I mis-communicated my situation. I gave example numbers for columns, when I should have been using row designations. In other words, I should have said the text title will be in A2, the result would go in B2, and the data would be in C2-J2. I would be adding data at the end of the row in K2, L2, M2, etc.

    Does that make sense?

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Formula to return percent of change in last 2 cells at end of row

    no problem just change to row
    try

    =(INDEX($C$2:$IV$2,1,MATCH(9.9999E+37,$C$2:$IV$2,1))-INDEX($C$2:$IV$2,1,MATCH(9.9999E+37,$C$2:$IV$2,1)-1))/INDEX($C$2:$IV$2,1,MATCH(9.9999E+37,$C$2:$IV$2,1))
    Last edited by martindwilson; 05-08-2009 at 02:49 AM. Reason: corrected formula

  5. #5
    Registered User
    Join Date
    05-06-2009
    Location
    Liverpool, NY
    MS-Off Ver
    Excel 2003
    Posts
    4

    Smile Re: Formula to return percent of change in last 2 cells at end of row

    This formula works very well. Thank-you for your assistance. Greatly appreciated.

+ 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.6.0 RC 1