+ Reply to Thread
Results 1 to 13 of 13

Formula for Sum Multiple Columns Based on Range From One Sum Function

  1. #1
    Registered User
    Join Date
    01-14-2016
    Location
    Concord, NC
    MS-Off Ver
    2013
    Posts
    16

    Formula for Sum Multiple Columns Based on Range From One Sum Function

    I have three columns of data. Sales, Cost and Profit. When the user Sums the sales for any number of rows....I want the same SUM to populate for the Cost and Profit based on the number of Rows chosen in the Sales Column.

    So if I SUM A3:A25 I want Cost to SUM B3:B25 and Profit to SUM C3:C25. The same number of Rows that were chosen in Column A.

    But if I change the SUM in column A to A3:A23 or A3:A5000 I want the SUM's in Column B and C to SUM the same Rows based the SUM of column A.

    I hope this makes sense. It seems very simple but I can't seem to find an answer online. Thank you for any help.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    1
    Sales
    Cost
    Profit
    Sales
    Cost
    Profit
    2
    84
    74
    10
    10
    435
    263
    172
    3
    16
    9
    7
    4
    40
    30
    10
    5
    14
    10
    4
    6
    86
    42
    44
    7
    17
    15
    2
    8
    78
    45
    33
    9
    65
    27
    38
    10
    35
    11
    24
    11
    44
    36
    8
    12
    50
    40
    10
    13
    95
    75
    20
    14
    79
    58
    21
    15
    72
    66
    6
    16
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------


    Enter the row number of the sum range in E2.

    This formula entered in F2 and copied across:

    =SUM(A2:INDEX(A:A,$E2))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    01-14-2016
    Location
    Concord, NC
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    Is there not a way to extract the value "total number of rows being Summed" and place that in cell E? So the user does not have to count and figure out this manually?

    If they sum column A - then the formula in Column E would figure out the number of rows being summed and apply this to the sums in column B and C.

    I just don't want the user to have to figure out this value themselves. Too many manual required inputs makes for more and more chances for errors by the user.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    How do you determine how many rows are to be included in the sum?

  5. #5
    Registered User
    Join Date
    01-14-2016
    Location
    Concord, NC
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    These files are estimates so the number of Rows would change every single day. There will be many different sums as you go down the sheet.

    Example - =sum(A3:A53) then again further down =sum(A54:A560) then again =sum(A:561:A670)

    These are subtotals so there could be 10 rows of items....there could be 11.....there could be 501948357 rows. It changes all the time.

    The user "subtotals" what it is they choose in column "A"....this is what is being sold. I want in Column B and C to mirror this same range but in its own column without the user having to manually sum all three columns......sum column A...then sum column B...then sum column C and so on which take too much time. I'm just trying to automate the "sum" in the respective columns for them.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    Sorry, I don't understand.

    You said:

    The user "subtotals" what it is they choose in column "A"
    OK, so how are they "choosing"?

    Are they using a mouse and selecting/highlighting the range?
    Last edited by Tony Valko; 04-19-2016 at 09:46 AM.

  7. #7
    Registered User
    Join Date
    01-14-2016
    Location
    Concord, NC
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    Grocery List...
    Column "A" are the prices or the items on your grocery list.
    There are 10 Items on your list.
    So in A11 you Sum the total of (A1:A10)
    In Column B is how much the store paid for the same items.
    in cell b11 there is a sum of the cost to the store (B1:B10)

    If you sum (A1:A10) I want B to sum the exact same amount of items. You may have 10 Items today on your list....tomorrow you go back to the store and you have 13 items...or 500 items and so on.

    If you figure out how much it cost you to buy your (x) number of items......I want it to figure out how much those same (x) number of items cost the store. Without having to sum "A" and then having to manually sum "B"

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    I understand what you WANT to do but you still haven't explained (that I can understand) how you determine what range of cells to sum.

  9. #9
    Registered User
    Join Date
    01-14-2016
    Location
    Concord, NC
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    The user manually clicks the sum button and selects in column A what they want to sum. Each user could have different amount of rows to sum in column A. But is done manually by the user selecting the sum button and then selecting the range themselves.

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    This is a real kludge!

    This requires Excel 2013 or later as your profile indicates that's what you're using.

    Let's assume the user enters this formula in cell E1:

    =SUM(A1:A5)

    Enter this formula in F1:

    =SUM(INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(FORMULATEXT(E1),"=SUM(",""),"A","B"),")","")))

    Enter this formula in G1:

    =SUM(INDIRECT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(FORMULATEXT(E1),"=SUM(",""),"A","C"),")","")))

    The formula in F1 will get the sum from column B and the formula in G1 will get the sum from column C.

    Here's a sample file created in Excel 2013 that demonstrates this.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    01-14-2016
    Location
    Concord, NC
    MS-Off Ver
    2013
    Posts
    16

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    Wonderful! Works like a charm!

    It theory I was thinking this was a very simple task but wow....I have fought for hours on end trying to figure it out. Thank you so very much.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    Quote Originally Posted by Tony Valko View Post
    Let's assume the user enters this formula in cell E1:

    =SUM(A1:A5)
    It doesn't matter how the formula gets there.

    They can type it in or use the insert function or the autosum commands, it doesn't matter!

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Formula for Sum Multiple Columns Based on Range From One Sum Function

    You're welcome. Thanks for the feedback!

+ 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. [SOLVED] countif function multiple columns moving range
    By Raspia in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-07-2015, 10:41 AM
  2. Replies: 1
    Last Post: 11-24-2015, 03:00 AM
  3. [SOLVED] Logical function based on multiple columns
    By TVRSD in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-03-2015, 03:24 PM
  4. Dynamic Named Range based on Pivot Table for MULTIPLE COLUMNS
    By Pho6 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-29-2014, 02:04 PM
  5. [SOLVED] Excel function to select two columns based on range
    By akshay8530 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-30-2014, 08:36 AM
  6. Replies: 10
    Last Post: 02-19-2013, 12:05 PM
  7. filtering based on multiple columns within a range.
    By CJPHX in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2010, 03:02 AM

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