+ Reply to Thread
Results 1 to 5 of 5

A formula to sum unique values within a dynamic range

  1. #1
    Registered User
    Join Date
    07-05-2016
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    5

    A formula to sum unique values within a dynamic range

    Hello all,

    I'm currently using the below formula and was wondering how to incorporate the offset function so it will work with an expanding data set.

    =SUMPRODUCT(1/COUNTIF(A:A,A:A&""),A:A)

    Thank you in advance.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: A formula to sum unique values within a dynamic range

    From what I can see, this is summing unique numbers in column A, which can contain either text or numbers. It's probably VERY slow as it's calculating down more than 1,000,000 rows. Do you really need that number of rows? So, what do you mean by an "expanding dataset"? If you mean that today there are 20 rows of data and tomorrow, 30 and the nxt day 40, then create a named range.

    here I created a Named range (called range) using the formiula:

    =Sheet1!$A$2:INDEX(Sheet1!$A$2:$A$1000,COUNTA(Sheet1!$A$2:A$1000))

    Your formula then becomes:

    =SUMPRODUCT(1/COUNTIF(Range,Range&""),Range)

    and only looks down column A as far as the last non-blank cell.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A formula to sum unique values within a dynamic range

    Here's a more efficient method.

    Create the dynamic range...

    Name: Range (or whatever you want to call it)
    Refers to: =$A$1:INDEX($A:$A,MATCH(1E100,$A:$A))

    Then, the sum formula would be:

    =SUM(IF(FREQUENCY(Range,Range),Range))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    07-05-2016
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    5

    Re: A formula to sum unique values within a dynamic range

    Thank you Glenn and Tony for your replies!

    Feel a bit daft for not thinking of creating a dynamic range which I've used countless times before.

    Best wishes

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A formula to sum unique values within a dynamic range

    You're welcome. Thanks for the feedback!

+ 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. Dynamic Named Range with Unique Values Only for Sumproduct Function
    By tlscowden in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2015, 03:16 PM
  2. Find unique values from a range using formula?
    By djarcadian in forum Excel General
    Replies: 8
    Last Post: 02-14-2015, 11:12 PM
  3. [SOLVED] Formula or VBA - Comparison CSV Values between 3 cells for used range. Find unique values.
    By grphillips in forum Excel Programming / VBA / Macros
    Replies: 36
    Last Post: 06-09-2014, 02:12 PM
  4. Dynamic Formula that summarizes data by unique values only
    By Trax in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-15-2013, 09:08 AM
  5. [SOLVED] need a formula that returns unique values in a range
    By James C in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2013, 02:26 PM
  6. Count Unique Values in Dynamic Range
    By Gos-C in forum Excel General
    Replies: 3
    Last Post: 01-19-2011, 01:20 PM
  7. Dynamic Range of Values from Formula
    By excel328 in forum Excel General
    Replies: 7
    Last Post: 07-18-2010, 08:35 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