+ Reply to Thread
Results 1 to 7 of 7

Adding a range of numbers based on a numerical input

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Adding a range of numbers based on a numerical input

    Hi guys & gals,

    Im stumped and need some help here. I'm trying to output a total of a range of cells, but the range will vary depending on a user input in another cell. Let me explain: On my "data" worksheet I have columns of numbers. The column A is Week #. On sheet 2 I want to show the sums for all or part of 9 columns based on the Week # that is entered in the cell C1 on the "data" worksheet. So if the user inputs "22" I need to generate the totals of column B, C, D etc from week 1 to 22 on the "overall report 2012" worksheet (I should note that there may be data in the columns for week 23, 24, etc). I have attached an example worksheet in case I haven't made a bit of sense in my explanation.
    Attached Files Attached Files
    Last edited by merlyn45; 06-21-2012 at 04:32 PM. Reason: solved

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Adding a range of numbers based on a numerical input

    Try this in A10 and dragged over

    =SUM('Overall Report 2012'!B2:INDEX('Overall Report 2012'!B:B,$C$1+1))

  3. #3
    Registered User
    Join Date
    05-09-2012
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Adding a range of numbers based on a numerical input

    Quote Originally Posted by Cutter View Post
    Try this in A10 and dragged over

    =SUM('Overall Report 2012'!B2:INDEX('Overall Report 2012'!B:B,$C$1+1))
    Works great! Thanks! Could you explain how this formula works? I want to learn how this works so I can gain more experience with Excel.

  4. #4
    Registered User
    Join Date
    05-09-2012
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Adding a range of numbers based on a numerical input

    I understand this formula up to the INDEX where row or column is stated...how does $c1+1 work?

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Adding a range of numbers based on a numerical input

    Sorry, missed your first request.

    The $C1+1 specifies the row number for the INDEX() function.
    Because you have a header in row 1 your data starts in row 2 so you have to add 1 to the value specified in C1 to get the correct row number for the INDEX() which has been specified as column B.
    Basically the formula breaks down to SUM(''Overall Report 2012'!B2:Bx) and C1+1 provides the value of x.

  6. #6
    Registered User
    Join Date
    05-09-2012
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Adding a range of numbers based on a numerical input

    Quote Originally Posted by Cutter View Post
    Sorry, missed your first request.

    The $C1+1 specifies the row number for the INDEX() function.
    Because you have a header in row 1 your data starts in row 2 so you have to add 1 to the value specified in C1 to get the correct row number for the INDEX() which has been specified as column B.
    Basically the formula breaks down to SUM(''Overall Report 2012'!B2:Bx) and C1+1 provides the value of x.
    YES! I get it now! Thanks so much! It makes total sense..dont know why I couldnt figure that out on my own. THANKS! YOU ROCK!

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Adding a range of numbers based on a numerical input

    You're welcome.
    YOU ROCK!
    Only on my front porch.

+ 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