+ Reply to Thread
Results 1 to 8 of 8

SUM with criteria and product for each value

  1. #1
    Registered User
    Join Date
    04-02-2015
    Location
    Rome, Italy
    MS-Off Ver
    Office 2007
    Posts
    3

    SUM with criteria and product for each value

    I need a table with the sums of the values from a column depending on the way they respond to certain criteria. It would have been fine using SUMIFS but the problem comes for those values that respond to different criteria at the same time and for this reason they need to be split.

    I found a formula that works for a couple of values but not one to give a sum for many values.

    I was probably not very clear. It is better that I explain it with the example from the spreadsheet attached hereto.

    In the chart "Income" I want to have the sum of the values coming from the columns Total Price divided in different cells depending on the origin of the client (World OR ITA) and the season each reservation falls in (Low Season, High Season, Very High Season).

    For example I was using =SUMIFS(C7:C11;G7:G11;"ITA";E7:E11;">=1") to put the right values in the cell J8.

    The problems come for those values from the column C that needs to be split in different cells of the table Income, like the €379 from C9. That reservation has nights in different seasons. In this case for example I need to sum 3/5*379 in K8 (World and HS) and 2/5 in K9 (World and VHS).

    I know how to do it for this few values (see formula below) but I need something that works like the SUM formula above in order to be able to add new lines and see immediately the results automatically changing in the table income, even if the value added needs to be split in different cells.

    =IF(AND(H7="World";E7<>"");C7*E7/G7;0)+IF(AND(H8="World";E8<>"");C8*E8/G8;0)+IF(AND(H9="World";E9<>"");C9*E9/G9;0)+IF(AND(H10="World";E10<>"");C10*E10/G10;0)

    Thank you all for your help!
    Attached Files Attached Files

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: SUM with criteria and product for each value

    What is the expected result of K8 cell and explain how you arrive it for giving exact solution


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    04-02-2015
    Location
    Rome, Italy
    MS-Off Ver
    Office 2007
    Posts
    3

    Re: SUM with criteria and product for each value

    Thank you for the reply.

    In this case the result of K8 should be 227,40€ (value 379€ only for its 3/5 goes in K8, the other 2/5 goes in K9).

    I would need a formula that will update cell K8 everytime I add a new line in the table to the left.

    For example (line 11 in red in the new spreadheet attached hereto) if I add a reservation with 100€ of Total Price, 4 nights total all in High season and origin World....the new result in K8 should be automatically 327,40€.
    Attached Files Attached Files

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: SUM with criteria and product for each value

    hi lodone. i suggest you type out manually a few answers in your desired results next time. that helps us ascertain we are on the right track. i am guessing you can try this array formula in J7:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    copy to the rest of the cells.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: SUM with criteria and product for each value

    Hi
    It seems column B values are total of D,E and F column, below formula and also benishyrio's works:
    Please Login or Register  to view this content.
    If not,
    Please Login or Register  to view this content.
    Put it in J7 then drag down and accross
    Quang PT

  6. #6
    Registered User
    Join Date
    04-02-2015
    Location
    Rome, Italy
    MS-Off Ver
    Office 2007
    Posts
    3

    Re: SUM with criteria and product for each value

    Quote Originally Posted by benishiryo View Post
    hi lodone. i suggest you type out manually a few answers in your desired results next time. that helps us ascertain we are on the right track. i am guessing you can try this array formula in J7:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    copy to the rest of the cells.
    First thing, thank you guys for your answers!

    I tried this formula but even pressing CTRL+SHIFT+ENTER the arrays do not appear and I get an error.

    Quote Originally Posted by bebo021999 View Post
    Hi
    It seems column B values are total of D,E and F column, below formula and also benishyrio's works:
    Please Login or Register  to view this content.
    If not,
    Please Login or Register  to view this content.
    Put it in J7 then drag down and accross
    I tried the first formula and it works perfectly, giving back the results I expect.

    There is only one problem and it probably depends by my lack of knowledge about excel world.

    I don't find the way to make it work adding new lines without changing every time the size of the matrix manually.

    The only way I found is to add an extra empty line on the top of the table on the left with just a 1 in column B to avoid the error #DIV/0.
    In this way I can extend the matrix including also this line giving me the possibility to add new lines below that one and having all the results updated autmatically.

    Of course I bet there is for sure a more elegant solution to solve this little issue...

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: SUM with criteria and product for each value

    Use this array formula for extended range to row 1000

    Please Login or Register  to view this content.

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

  8. #8
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: SUM with criteria and product for each value

    Here is a sheet using the Excel Table feature. You can just add data below the table and it will automatically expand the size of the Table and the formulas.
    http://www.jkp-ads.com/articles/Excel2007tables.asp
    http://chandoo.org/wp/2009/09/10/data-tables/
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

+ 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. SUM IF (criteria) then PRODUCT
    By manywise in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 09-04-2014, 07:01 PM
  2. Product if 3 criteria
    By ygoksel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-04-2014, 06:45 AM
  3. Sum Product with Two Criteria
    By lel33 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-02-2012, 01:37 PM
  4. Replies: 1
    Last Post: 01-14-2012, 12:00 PM
  5. Product with Criteria
    By axed in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-29-2010, 06:14 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