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!
Bookmarks