+ Reply to Thread
Results 1 to 11 of 11

Sum of Table given two criterias

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    12

    Unhappy Sum of Table given two criterias

    Hi all,

    So lets say I have this table (generated from Software, can't change format) - attached.

    If I wanted to get the total sum of "Oranges" from "Basket 4", what would be the formula to do so? I'm trying to design a Excel Template atm (for future use), so in the future there might be more "Baskets" added for each, such as Basket 2 and 3 for "Oranges"

    Also, is it possible to sum up to a certain date as well? Like Sum of Pineapples from Basket 3, from Jan - Sep and then next month it would be Jan - Oct?

    Thanks for all the help provided,
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sum of Table given two criterias

    Yes, those things can be done.

    1) You are familiar with pivot table?

    2) You are alowed to work with macro's?
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Sum of Table given two criterias

    Hi oeldere,

    Im still a beginner when it comes to some of the more advanced Excel stuff, and haven't used Pivot Tables that much. I think its okay to use macros, but I've never used them before.

    Thanks,

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sum of Table given two criterias

    1) Highlight A2:A11 (or however far down the data goes.)
    2) Press CTRL-G > Special > Blanks
    3) Carefully press = then the UP arrow
    4) Now press CTRL-ENTER to enter that formula into all the blank cells at once. This fills in the missing category cells.

    Now the formulas demonstrated here will work.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sum of Table given two criterias

    We gonna do this step by step.

    It will be maybe to quick for you, but then you have to ask for an time-out so I could explain it to you.

    First of all, we need to fill the data in column A, with the names of the fruits.

    We need this data for the pivot table we gonna use.

    Push on the button and see what happens.

    Behind the button is a code (VBA) which will fill the data in column A.

    You have to allow Excel to use macro's (otherwise the code will not run).

    Try this and reply back.

    See the attached file.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Sum of Table given two criterias

    Alright, got the data in column A filled out by using the macro.

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Sum of Table given two criterias

    This uses a Pivot table to summarize your data.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sum of Table given two criterias

    Now we gonna rearange the data so it can be easy used for an pivot table.

    I used a code to do that.

    I put it behind button 2.

    Notice I filled cell a1 and cel b1 with text.

    Notice there is no sheet Output => it will make itself.

    Sheet Output will be filled with all the data in your sheet.

    After this we gonna make the pivot table.

    Try step 2 and please respond back.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-29-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Sum of Table given two criterias

    Alright got the Output sheet avaliable.

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Sum of Table given two criterias

    Now we gonna make the pivot table.

    Since you use Excel 2010 it's maybe a little diffirant, but let's take a try.

    See the attached file for the (first) result.

    We gonna expand this table after this.

    I posted also an word doc with the text in it.

    Do you have questions or comments, just ask or comment.

    text in the word file.
    Click in a cell of the table (e.g. b3)
    Excel 2007 => Insert => pivot table
    You find these text in the table Output!$A$1:$D$109
    Select your location for the pivot table new worksheet
    You will see the lay out of the pivot table on the left side of your sheet.
    On the right side you see some Boxes with the text:

    Fruit drag this one in the box row(value)
    Basket
    Month drag this one in the box row(value)
    Value drag this one in the box values (and choose sum)

    Format the value (after it’s dragged in the box values (and been summed) to value with 2 decimals.

    The result should be, like in my file.

    After that you can e.g. drag the Baskets in the column box
    You get an new pivottable, with the new values in it.

    If you don’t want to see the Baskets in the column, just drag them back from the column Box to the list.
    Now you need playing (drag and drop) to see what kind of information you need.
    If you need help by that, just ask.
    Last edited by oeldere; 07-29-2013 at 04:06 PM.

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sum of Table given two criterias

    Post #4 has an already working solution using basic formulas, too. Be sure to check it out, too.

+ 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 across 4 criterias
    By msls09 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-05-2013, 08:33 AM
  2. [SOLVED] Returning Value, that is not in table form, that matches 3 criterias
    By chongwz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-03-2013, 05:25 AM
  3. Returning Value, that is not in table form, that matches 3 criterias
    By chongwz in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-26-2012, 08:07 PM
  4. Look up a value for two criterias
    By Chandrani in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-16-2009, 04:38 PM
  5. summing a pivot table based on for criterias
    By jwongsf in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-17-2009, 05:17 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