+ Reply to Thread
Results 1 to 2 of 2

calculation of variation of data of rolling columns

  1. #1
    Registered User
    Join Date
    02-26-2016
    Location
    Milan
    MS-Off Ver
    2013
    Posts
    5

    calculation of variation of data of rolling columns

    Hi Guys!
    Hope to find you well!

    I got a problem with a VBA code.

    here the problem:
    I get 2 sheets: sheet1 and sheet2.

    Sheet2 changes every day, fulling in one more column each day that passes. for example Day one there will be 2 column filled with data, day 2, 3 columns and so on.

    I was wondering how i can write a formula in VBA on sheet1 (let's say in B7) for calculating the variation in %(e.g. expressed (N7-M7)/M7 ) of the last two columns in sheet2.

    Ideally this formula will calculate the following
    The first time, the formula will calculate (N7-M7)/M7, being N7 and M7 the last 2 column "not empty" in sheet2. The second time the formula will calculate (O7-N7)/N7, being O7 and N7 the last columns "not empty" in sheet 2. And so on.

    Help would be amazing !
    thanks !
    Dan

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: calculation of variation of data of rolling columns

    Try

    =(INDIRECT("Sheet2!R"&CELL("row")&"C"&COUNTA(Sheet2!7:7),FALSE)-INDIRECT("Sheet2!R"&CELL("row")&"C"&COUNTA(Sheet2!7:7)-1,FALSE))/(INDIRECT("Sheet2!R"&CELL("row")&"C"&COUNTA(Sheet2!7:7),FALSE))

    in B7.

    I have assumed that columns to the left of the last column have values in them as I am counting them to work out where the last column is.
    Martin

+ 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. Rolling AFR calculation
    By Callingavan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-15-2013, 05:57 AM
  2. Calculation of rolling data into another month
    By rab0911 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 09-26-2012, 04:43 AM
  3. [SOLVED] Rolling Calculation
    By Northumberland81 in forum Excel General
    Replies: 3
    Last Post: 06-05-2012, 07:18 AM
  4. Excel 2008 : YTD Rolling calculation
    By samjam in forum Excel General
    Replies: 0
    Last Post: 07-25-2011, 01:20 PM
  5. Rolling over data in columns
    By payrollgal in forum Excel General
    Replies: 0
    Last Post: 10-09-2008, 10:30 AM
  6. Rolling calculation
    By tanksalevikrant in forum Excel General
    Replies: 1
    Last Post: 01-20-2008, 01:02 AM
  7. Replies: 0
    Last Post: 09-15-2005, 09:05 AM
  8. Replies: 0
    Last Post: 09-14-2005, 06:05 PM

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