+ Reply to Thread
Results 1 to 4 of 4

Incorporating a unique value criteria into sumifs()

  1. #1
    Registered User
    Join Date
    08-22-2023
    Location
    Pennsylvania, USA
    MS-Off Ver
    365
    Posts
    3

    Incorporating a unique value criteria into sumifs()

    Hi folks,

    I'm working with a CSV file that has columns for, among other things, zip code of sale, name of seller, units sold, and seller's distance to the zip code.
    I'm trying to write a one-cell formula that takes a seller's name as input and returns the total sales for all zip codes within a certain distance of that seller.

    The problem I'm running into is that individual zip codes can be repeated, but the total sales value is constant for each zip, so I only need to include each total sales value in the sum one time. I want to use a sumifs() function, but it would add the duplicated zip code sales values and return an inflated number. For example, if zip code 00000 met the distance criteria, and had 100 total sales in the zip, but was repeated 3 times for the same seller, sumifs() would return 300 total sales instead of the 100 total sales I'm looking for.

    I've been trying to incorporate the unique() function into the sumifs() function with little success. I've also tried incorporating the filter() function into the unique() function but can't figure out how that would work.

    I'd really like to make this work in a one-cell formula without going to VBA. I've attached some dummy data in an excel file as an example. In the context of the example, if I selected John as the seller and the distance as 5, I would expect a return value of 150, which excludes all but one of the duplicate zip code values and excludes the zipcode that has a distance greater than 5.

    Any help would be greatly appreciated, thanks in advance for your time!
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: Incorporating a unique value criteria into sumifs()

    When I look at your data, there is only one record with a distance greater than 5 and the result is 75. Please clarify.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-22-2023
    Location
    Pennsylvania, USA
    MS-Off Ver
    365
    Posts
    3

    Re: Incorporating a unique value criteria into sumifs()

    Thanks for your reply.

    Yes, you are right, but that is a value I am trying to exclude. I'll try to clarify - what I am trying to do is write a formula that would sum the "total zip sales" column for all rows that have the same value for "name", a manually specified criterion for "distance" (I arbitrarily chose <5 for my example,) while only summing each unique "zip"s associated value in "total zip sales" once. The record with a distance greater than 5 would be excluded from that sum in my example. My issue is the duplicate zip codes resulting in duplicate values in the "total zip sales" column, which is the sum range. I only want to incorporate the "total zip sales" for each unique zip code one time, not three times as would happen with the value for "19104" in the example.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Incorporating a unique value criteria into sumifs()

    Could this work for you? Use a helper column. Column H >> =COUNTIF($D$2:D2,D2)

    John >> in I1
    5 >> in K1

    M1 >> =SUMIFS(F2:F9,A2:A9,J1,H2:H9,1,G2:G9,"<"&K1)
    HTH
    Regards, Jeff

+ 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. [SOLVED] SUMIFS with Unique?
    By WaveWalker116 in forum Excel General
    Replies: 3
    Last Post: 09-10-2021, 02:05 PM
  2. [SOLVED] SUMIFS summarizing using unique values as criteria
    By Kinky in forum Excel General
    Replies: 6
    Last Post: 04-15-2018, 12:58 AM
  3. Replies: 0
    Last Post: 08-22-2017, 03:49 PM
  4. [SOLVED] NETWORKDAYS-Incorporating 3 criteria in one formula
    By cmkarnes in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-04-2015, 08:19 PM
  5. [SOLVED] Need unique list based on another list and incorporating =RIGHT(...) formula
    By NS4Excel in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 03-31-2014, 10:10 PM
  6. [SOLVED] SUMIFS, multiple criteria incl. unique values
    By rinkjames in forum Excel General
    Replies: 7
    Last Post: 06-16-2012, 07:15 PM
  7. Sumifs incorporating day of week tests
    By imam299 in forum Excel General
    Replies: 1
    Last Post: 08-10-2011, 08:01 PM

Tags for this Thread

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