+ Reply to Thread
Results 1 to 4 of 4

Thread: SUMIF function

  1. #1
    Registered User
    Join Date
    02-17-2010
    Location
    Lucca, Italy
    MS-Off Ver
    Excel 2003
    Posts
    1

    SUMIF function

    I have the following problem that I would like to approximate in this simplified manner - Imagine you have these two columns:

    A 1
    A 2
    A 3
    B 0
    B 2
    A 4
    A 5
    B 4
    B 8

    and you want to generate one third column out of these two that adds up all previous values of A and B so far at each step whenever A and B appear again. In other words the new, third column should look like this:

    0
    1
    3
    0
    0
    6
    10
    2
    6

    10 for example comes from the sum of all 'A' letter values before the new one (1+2+3+4). By analogy 2 comes from the sum of all 'B' letter values before the new one (0+2). I hope it is clear. As you probably understood if the problem was adding all the values of A or B in the end this would be solved easily. But my wish is to have this done in one column in such a way that the current total is shown after each new cell. The constraints are simple - I need to do this all in one column; and I should also not sort the A's or the B's - in other words you cannot change the order. If someone can help me construct this third column out of this data with a function I will highly appreciate it and I thank him/her very much in advance.
    Last edited by Papen83; 02-17-2010 at 09:35 PM. Reason: title change

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,225

    Re: I small but annoying problem...

    If those represent the values in A1 through B9, put this formula in C2 and copy down:

    =SUMIF($A$1:A1, A2, $B$1:B1)

    You'll have to just expect C1 = 0 since there are no prior values.
    _________________
    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!)

  3. #3
    Forums Administrator royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    24,443

    Re: I small but annoying problem...

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
    Check out the free Excel Toolbar

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)


    Code Tags: Make your code easier for us to read

  4. #4
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,225

    Re: Step by step SUMIF function

    Thanks for updating your title...

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].
    _________________
    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!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0