+ Reply to Thread
Results 1 to 10 of 10

SUMIF duplicate

  1. #1
    Registered User
    Join Date
    11-10-2010
    Location
    Oslo
    MS-Off Ver
    Excel 2007
    Posts
    38

    SUMIF duplicate

    Hi

    I have two columns with hard data.

    Column A
    1234
    1234
    1234
    5678
    5678
    9876
    9876
    9876
    9876

    Column B
    10
    10
    -20
    30
    -30
    100
    100
    100
    -300

    Column C (Here I want my formula)

    I want to sum the values in column B which belongs to the data in column A. Example: Sum 10+10-20 because the value in A1, A2 and A3 are the same.

    If no duplicate is found in column A; then I just want the connetcted value in column B as a result.
    Last edited by magman1984; 02-10-2011 at 11:55 AM.

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: SUMIF duplicate

    If I understand correctly, you can use SUMIF() to do this:

    =SUMIF($A$1:$A$9,$A1,$B$1:$B$9)

    copied down
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    11-10-2010
    Location
    Oslo
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: SUMIF duplicate

    Thanks.

    What if I have a third column C with hard data and want both column A and C as a argument?

    Column A
    1234
    1234
    1234
    5678
    5678
    9876
    9876
    9876
    9876

    Column B
    10
    10
    -20
    30
    -30
    100
    100
    100
    -300

    Column C
    A
    A
    A
    B
    B
    C
    C
    C
    C

    Only sum if column A got duplicates (first criteria), and column C (second criteria).
    F.eks.
    Sum data from column B if $A$1:$A$9 got duplicates, but only if $C$1:$C$9 also duplicates.
    Last edited by magman1984; 02-10-2011 at 09:11 AM. Reason: Expanded my example

  4. #4
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: SUMIF duplicate

    There are a couple of ways to do this. Since you are using Excel 2003 and there could be many rows of data, I think a good approach for you would be to use a helper column. In a spare column you can concatenate the values in columns A and C (separating them with an unusual character to prevent an unlikely miscalculation) and then to use that column as the criteria for summing.

    For example, with your data in A1:C9, in cell E1 you could put this formula and fill down to E9:
    =A1&"-"&C1

    Then, to get your totals (say in column G), put in this formula and fill down:
    =SUMIF($E$1:$E$9,E1,$B$1:$B$9)

    Hope that helps...
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-10-2010
    Location
    Oslo
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: SUMIF duplicate

    Quote Originally Posted by Colin Legg View Post
    Since you are using Excel 2003
    Sorry, I have to change that. I got 2007 version on this computer.

    I will try to do it the "Excel 2003 way", but it's maybe possible to do it without a helper column in version 2007?
    Last edited by magman1984; 02-10-2011 at 11:07 AM.

  6. #6
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,255

    Re: SUMIF duplicate

    Yes, in Excel 2007 you can use the SUMIFS() worksheet function.

    =SUMIFS($B$1:$B$9,$A$1:$A$9,A1,$C$1:$C$9,C1)


    It is actually very possible to do this without a helper column in Excel 2003, but the formula is inefficient and would be overly complicated for a new user, hence why I recommended the helper column.

  7. #7
    Registered User
    Join Date
    11-10-2010
    Location
    Oslo
    MS-Off Ver
    Excel 2007
    Posts
    38

    Re: SUMIF duplicate

    Thank you, again!

    This saves me a lot of time.

  8. #8
    Registered User
    Join Date
    08-18-2011
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: SUMIF duplicate

    This is excellent help. If I could just build on this question with a question of my own.

    I have implemented the SUMIF function, but I want the formula to subtract out the # in column K IF column M has the words "2010 End Bal". The columns I am using are Column A, Column K, and Column M. Column A has all my policy numbers. Column K has my Journal Transaction Amounts. Column M has "end balance 2009" and "2010 End Bal".

    My current formula is =SUMIF($A$2:$A$56074,$A2,$K$2:$K$56074). It works half way b/c it is including the "2010 End bal" transaction totals that I do not want included b/c I am comparing the end balance 2009 + transactions throughout the year to the 2010 End Bal.

    Any help is greatly appreciated!!

  9. #9
    Valued Forum Contributor Miraun's Avatar
    Join Date
    04-03-2009
    Location
    New England
    MS-Off Ver
    2003, 2007, 2010, 2013
    Posts
    554

    Re: SUMIF duplicate

    Nope. Hijacking others' threads to ask additional questions is against the forum rules. I'm sure one of the admins will do one of their copy/paste mean messages. You can always start a new thread referencing this one though... I've definitely been guilty of that a couple times...

    And I replied to your other thread regarding the data.
    Going for Guru! Click the Star to the bottom left of this post if I helped!

  10. #10
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: SUMIF duplicate

    To confirm:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

+ Reply to Thread

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.6.0 RC 1