+ Reply to Thread
Results 1 to 6 of 6

How to sum between two column ranges with a changing variable

  1. #1
    Registered User
    Join Date
    04-21-2011
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    61

    How to sum between two column ranges with a changing variable

    I am not sure how else to describe the formula I'm trying to create but here goes.

    I have 2 products, product A and B. Each product has 4 stages along their development that increase their value by predetermined amounts (stage A-D). On a separate part of the worksheet, I would like to be able to sum the progress made on each product depending on a variable cell that the user selects.

    In the example attached, the user would have selected Stage C from the dropdown and the formula I need to create would sum product 1 and 2 individually from Stage A to Stage C in cells H3 and H4 respectively.

    The end result should be:
    Product 1 = 254
    Product 2 = 171

    I am thinking a SUMPRODUCT formula of some sort would do the trick but my knowledge is rather limited.

    Any ideas?
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,418

    Re: How to sum between two column ranges with a changing variable

    Try this:

    =SUM(OFFSET($B3,0,0,1,MATCH(H$2,$B$2:$E$2,0)))

    Copy down.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: How to sum between two column ranges with a changing variable

    Or you can use

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    and copy down

  4. #4
    Registered User
    Join Date
    06-11-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: How to sum between two column ranges with a changing variable

    Hey,

    Good question. This can be done many different ways. My solution is to "=SUM(B4:OFFSET(A4,0,MATCH($H$2,$B$2:$E$2),1,1))" in H3.

    The match is a lookup on your defined value (how many columns from the beginning). The sum starts at b4 and wants to add the range identified by the offset. So... the offset says to start on A4, move 0 rows, move 3 columns to the right, and select 1 cell)

    So add B4-(3 columns to the right).

    The current assumption is that all products start at A and have the whole value of A. You can add more logic to formula to account for % completed in each section. So if only half done for C. It would add all of A and B and only 50% of C. I have included a section for this as well.

    I hope this helps and solves your problem.

  5. #5
    Registered User
    Join Date
    04-21-2011
    Location
    Boston
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: How to sum between two column ranges with a changing variable

    Thank you very much! These work great. And learning how the OFFSET formula works will save me a ton of time in the future on similar scenarios.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,418

    Re: How to sum between two column ranges with a changing variable

    You’re welcome!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Column chart with variable data ranges
    By jarydmiles in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-18-2016, 11:17 AM
  2. Need MAX formula to include column references from changing ranges
    By PeteABC123 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-11-2016, 04:36 PM
  3. Changing column variable on a copied formula instead of row variable
    By dsw283 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-06-2014, 04:13 PM
  4. Changing column name in named ranges
    By goels in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2012, 08:27 AM
  5. Macro to copy and paste variable ranges according to values in a column
    By abinayan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2011, 11:11 AM
  6. Ranges, Column and changing values automatically
    By jhkr1977 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2008, 07:19 AM
  7. [SOLVED] Counting variable ranges and auto-summing variable ranges
    By Father Guido in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2006, 11:10 PM

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