+ Reply to Thread
Results 1 to 10 of 10

SUM until condition met

  1. #1
    Registered User
    Join Date
    09-30-2013
    Location
    oakland, ca
    MS-Off Ver
    Excel 2003
    Posts
    16

    SUM until condition met

    hey guys,

    i can't seem to solve this seemingly simple problem.

    i want SUBTOTAL column to display what's below, by adding up all the cost of the main product.

    i tried messing around with index and match with if, but can't get it all to work.

    anyone with a simple solution?

    file is attachedSUM until.xlsx

    MAIN PRODUCT SUB PRODUCT COST SUBTOTAL
    BREAKFAST 10 10
    SERVICE 75
    BAR 30
    RECEPTION 45
    DINNER 50 50


    *SUBTOTAL IS DISPLAYED ONLY ON THE THE MAIN PRODUCT ROW
    *SUBTOTAL IS CALCULATED BY SUM OF ALL COST UNTIL NEW PRODUCT IS ENCOUNTERED ON COLUMN A

  2. #2
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: SUM until condition met

    I got a strange error while trying to save your file... but i believe I accomplished your goal with a 'helper formula' in cell F2 copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    and the following in your subtotal column, (cell D2 copied down):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: SUM until condition met

    Also... you need to add another word below Dinner...

  4. #4
    Registered User
    Join Date
    09-30-2013
    Location
    oakland, ca
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: SUM until condition met

    nice! thanks for that. will have to study up on match and offset as i'm not too familiar with them.

    but is there an easy fix for NOT adding a text below the last entry (dinner) to make this work?

    thanks for the help.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM until condition met

    Hi,

    In D2 and copy down:

    =IF(A2="","",SUMPRODUCT((LOOKUP(ROW($A$2:$A$6),(1/($A$2:$A$6<>"")*ROW($A$2:$A$6)),$A$2:$A$6)=A2)*$C$2:$C$6))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  6. #6
    Registered User
    Join Date
    09-30-2013
    Location
    oakland, ca
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: SUM until condition met

    wow.. it works!
    thanks!!

    time to study those formulas...

  7. #7
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM until condition met

    You're welcome.

  8. #8
    Registered User
    Join Date
    09-30-2013
    Location
    oakland, ca
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: SUM until condition met

    hey guys,

    i revived the thread because need some more help~

    the solution provided here works great if i create simple lists. but for some reason trying to insert this formula in the form i'm working on (so_test.xlsx), returns (#value!).

    i tried working backwards, simplifying the form by deleting all unnecessary fields, but for some reason it keeps returning #value!.

    i'm attaching two files: data_test.xlsx needs to be opened first because so_test.xlsx refers to it.

    i highlighted 3 columns in yellow:

    column c: products
    column o: cost
    column aa: where i want the grouped totals to display

    i've already put in the formula by XOR LX in column aa, which is displaying "value#!".

    i've been working on this for many hours now and just can't make any progress. help is very much appreciated!!
    Attached Files Attached Files

  9. #9
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: SUM until condition met

    Hi,

    SUMPRODUCT will not sum arrays containing text entries (the "" as a result of your formulas in LIST2).

    Perhaps change your formula in O18 to:

    =IF(F18="",0,F18*M18)

    and, if you wish, use a custom number format or conditional formatting to mask zero values.

    Regards

  10. #10
    Registered User
    Join Date
    09-30-2013
    Location
    oakland, ca
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: SUM until condition met

    thanks again!

    worked perfectly!

+ 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] Help for if condition formula result only either hit or miss from mulitple condition
    By breadwinner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 07:29 AM
  2. open a comment to cell range upon true condition then removing comment on false condition
    By ferrum_equitis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2012, 12:55 AM
  3. Replies: 6
    Last Post: 05-06-2010, 10:06 PM
  4. Running an if condition looped with another if condition in VBA
    By anuj.agarwal in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-04-2010, 08:12 PM
  5. multi condition format? lookup and date condition valid for.
    By D_Rennie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-13-2009, 11:37 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