+ Reply to Thread
Results 1 to 8 of 8

summing first occurance of values

  1. #1
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    summing first occurance of values

    A 1
    B 2
    B 2
    C 3
    A 1
    C 3
    --------
    my sum should be 6....first occurance of A, B, C

    -cannot sort on anything

    Thanks in advance!
    Last edited by TechRetard; 04-13-2011 at 02:44 PM.
    TechRetard.ToString();

    There are always multiple ways to do something, when it doubt, drink a beer.

    I do not care if you rep or not but please mark post as Solved if there is resolution so I stop going back and checking if anything else is needed.

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

    Re: summing first occurance of values

    Add a helper column:

    =IF(COUNTIF(A$1:A1,A1)=1,B1,"")

    copied down (assuming data in A1:B6)

    Then use: =SUM(C1:C6)
    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.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: summing first occurance of values

    Or, in a similar vein;
    In helper column
    =COUNTIF($A$1:A1,A1)
    Result;
    =SUMIF($C$1:$C$6,1,$B$1:$B$6)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Re: summing first occurance of values

    Quote Originally Posted by ChemistB View Post
    Or, in a similar vein;
    In helper column
    =COUNTIF($A$1:A1,A1)
    Result;
    =SUMIF($C$1:$C$6,1,$B$1:$B$6)
    any way around helper columns? i have 60k rows...thats a lot of formulas...

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

    Re: summing first occurance of values

    You would need an array formula and 60,000 rows is a lot to process for the array formula... it would be more efficient to use the helper... especially if you have other things going on in the workbook that might add to the resource eating.

  6. #6
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Re: summing first occurance of values

    Quote Originally Posted by NBVC View Post
    You would need an array formula and 60,000 rows is a lot to process for the array formula... it would be more efficient to use the helper... especially if you have other things going on in the workbook that might add to the resource eating.
    right... yah that would be a lot of checks in the array; alright, thanks guys, appreciate the help

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

    Re: summing first occurance of values

    If you wanted to give it a test, then try:

    Please Login or Register  to view this content.
    adjust ranges to suit and confirm with CTRL+SHIFT+ENTER

  8. #8
    Forum Contributor TechRetard's Avatar
    Join Date
    06-14-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    202

    Re: summing first occurance of values

    Quote Originally Posted by NBVC View Post
    If you wanted to give it a test, then try:

    Please Login or Register  to view this content.
    adjust ranges to suit and confirm with CTRL+SHIFT+ENTER
    Seems to work but takes too long, little less than a half a minute....thanks i'll try and work with the helper or try reformatting my data

+ 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