Results 1 to 7 of 7

Macro to extend formula with sum of every other two rows

Threaded View

mmchung Macro to extend formula with... 01-18-2013, 02:50 AM
NickyC Re: Macro to extend formula... 01-18-2013, 03:24 AM
mmchung Re: Macro to extend formula... 01-18-2013, 03:59 AM
NickyC Re: Macro to extend formula... 01-18-2013, 04:26 AM
NickyC Re: Macro to extend formula... 01-18-2013, 04:33 AM
kvsrinivasamurthy Re: Macro to extend formula... 01-18-2013, 05:17 AM
mmchung Re: Macro to extend formula... 01-18-2013, 07:17 AM
  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    3

    Macro to extend formula with sum of every other two rows

    Hello…
    I have two worksheets, one with monthly data (‘monthly’ sheet) and the second (‘quarterly’ sheet) with excel formula transferring monthly data into quarterly ones. I have added new rows in the second worksheet. Now I want to extend the formula used in the previous rows and do this via VBA. However, the formula is the sum of every other two rows, which makes the macro difficult to write.

    For example, I have following formulas in the quarterly sheet:

    .............Column A..........Column B
    Row10... 2011-Q1... =SUM(Monthly!B5:B7)
    Row11... 2011-Q2... =SUM(Monthly!B8:B10)
    Row12... 2011-Q3... =SUM(Monthly!B11:B13)
    Row13... 2011-Q4... =SUM(Monthly!B14:B16)
    Row14... 2012-Q1... =SUM(Monthly!B17:B19)
    Row12... 2012-Q2... =SUM(Monthly!B20:B22)
    Row16... 2012-Q3... =SUM(Monthly!B23:B25)
    Row17... 2012-Q4... =SUM(Monthly!B26:B28)

    Now, I want to extend the formula for one more year as the following, highlighted in red:

    .............Column A..........Column B
    Row10... 2011-Q1... =SUM(Monthly!B5:B7)
    Row11... 2011-Q2... =SUM(Monthly!B8:B10)
    Row12... 2011-Q3... =SUM(Monthly!B11:B13)
    Row13... 2011-Q4... =SUM(Monthly!B14:B16)
    Row14... 2012-Q1... =SUM(Monthly!B17:B19)
    Row15... 2012-Q2... =SUM(Monthly!B20:B22)
    Row16... 2012-Q3... =SUM(Monthly!B23:B25)
    Row17... 2012-Q4... =SUM(Monthly!B26:B28)
    Row18... 2013-Q1... =SUM(Monthly!B29:B31)
    Row19... 2013-Q2... =SUM(Monthly!B32:B34)
    Row20... 2013-Q3... =SUM(Monthly!B35:B37)
    Row21... 2013-Q4... =SUM(Monthly!B38:B40)


    I have to do this for 30 workbooks and it is extremely helpful if I can just run the macros to do the work.

    Help and thanks in advance!
    Last edited by mmchung; 01-18-2013 at 07:50 AM.

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