+ Reply to Thread
Results 1 to 10 of 10

can't add rows of data dictate by a number in a cell

  1. #1
    Registered User
    Join Date
    06-07-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    6

    can't add rows of data dictate by a number in a cell

    Hello everyone. I am new to the forum and hope someone can help me with this. I am trying to add multiple rows of data base on a number I put in a cell. For example, in cell C1(this is where I put the number of rows I want to add), I put 2. In Cell B1, it will add Cell A1+A2. If I change the number in C1 to let's say 3, in Cell B1, it will add Cell A1+A2+A3. I tried to look up formulas in excel but was unsuccessful. I assume I have to write some VBA (which I am a newbie to this). Greatly appreciated to anyone that can help. Thanks.
    Last edited by mdrx7; 06-08-2010 at 11:10 AM. Reason: need new title base on the forum rule

  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

    re: add rows of data dictate by a number in a cell

    In B1, =SUM(A1:INDEX(A:A, C1))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-05-2010
    Location
    Fl, Usa
    MS-Off Ver
    Excel 2001
    Posts
    19

    re: add rows of data dictate by a number in a cell

    Sorry I miss read your post, ignore this answer

    If this is what you are wanting to do.

    In Cell A1 put a 1
    In Cell A2 put this formula
    Please Login or Register  to view this content.
    Now copy the formula down as far as you need it.

    Now when you put a number in Cell C1 it will fill down from the number 1 to whatever number is in cell C1.
    Example:
    C1 = 5
    you'll get this in column A
    1
    2
    3
    4
    5
    Last edited by spreadcore; 06-07-2010 at 11:36 PM.

  4. #4
    Registered User
    Join Date
    06-07-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: add rows of data dictate by a number in a cell

    Quote Originally Posted by shg View Post
    In B1, =SUM(A1:INDEX(A:A, C1))
    Thanks for all the help guys. Greatly appreciated. Shg, I tried to use your formula, it works for the first Cell B1 for the solution, however, if I want to continue down the column B correspond to the data on column A, it spits out some funny answer. Example. I have Cell A1 = 1, A2 = 2, A3 = 3, and Cell C1 = 2(this is the formula you have given me). Now B1 = 3 which is correct. Now I want the same formula in B2 and I copy and paste (I also freeze cell C1), but now my answer in B2 = 2 which should be 5 (A2 + A3 = 5). Thanks guys again for looking into this for me. Appreciate all the help

  5. #5
    Registered User
    Join Date
    06-07-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: can't add rows of data dictate by a number in a cell

    Any suggestions?

  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

    Re: can't add rows of data dictate by a number in a cell

    =SUM(A$1:INDEX(A:A, C1))

    If that doen't work, post a workbook with manual examples.

  7. #7
    Registered User
    Join Date
    06-07-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: can't add rows of data dictate by a number in a cell

    Quote Originally Posted by shg View Post
    =SUM(A$1:INDEX(A:A, C1))

    If that doen't work, post a workbook with manual examples.
    Shg, Thanks for your reply. I tried what you suggested but it's still doing the same. I have attached a example spreadsheet to illustrate what I am trying to do. Thanks again for your help.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-07-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: can't add rows of data dictate by a number in a cell

    still can't figure it out. Anyone?

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: can't add rows of data dictate by a number in a cell

    Try this

    =SUM(A2:INDEX(A:A, $C$1+ROW(A2)-1))

    Copy it down
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  10. #10
    Registered User
    Join Date
    06-07-2010
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2003
    Posts
    6

    Thumbs up Re: can't add rows of data dictate by a number in a cell

    RoyUK

    Yes, this is it. Thanks for all the help guys. You guys been really helpful.
    Last edited by shg; 06-18-2010 at 07:47 PM. Reason: deleted quote

+ 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