+ Reply to Thread
Results 1 to 5 of 5

Dynamic sum of rows

  1. #1
    Registered User
    Join Date
    03-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    2

    Dynamic sum of rows

    Hi All,

    My .csv incoming file has data as follows
    Company_name Company_Code Amount
    ARS 001 32
    ARS 001 54
    ARS 002 11
    PPP 123 10
    PPP 123 54
    ASP 555 22

    I want to get the sum of amount based on company name and company code
    The number of rows can change all the time .i am new to VBA .Any help is appreciated.I want to write a macro for this .the out file should be like this
    Company_name Company_Code Amount Sum
    ARS 001 32
    ARS 001 54 86
    ARS 002 11 11
    PPP 123 10
    PPP 123 54 64
    ASP 555 22 22

  2. #2
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Dynamic sum of rows

    Try to use pivot table......
    Easy and more efficient...

  3. #3
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166

    Re: Dynamic sum of rows

    A pivot table is your best bet but if you do not want to use one then you can use Array formulas and named ranges. These are generally easy to use and will do the trick.
    Reach me at excel_help at bellsouth dot net

  4. #4
    Registered User
    Join Date
    03-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Dynamic sum of rows

    How to use array formulas and named ranges .Do you have any example
    I tried to put pivot table in a macro ,but its not showing up correctly

    Thanks
    Last edited by nia_manuel; 03-09-2009 at 04:05 PM.

  5. #5
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166

    Re: Dynamic sum of rows

    This page explains it pretty well. http://www.cpearson.com/excel/ArrayFormulas.aspx

    Here is a page for named ranges. http://www.cpearson.com/excel/named.htm
    Last edited by Tarball; 03-09-2009 at 04:42 PM.

+ 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