Help with to find donations in one year but not the next.

NeedInformation

New Member
Joined
Feb 23, 2014
Messages
14
Office Version
  1. 2021
Platform
  1. Windows
I'm having a brain cramp with trying to determine the total number (both in dollars and number of unique donors but reported separately) of all donors who gave in the first year but not in the second that live in a certain city. I don't need the donors themselves, just the total of the donations and number of unique donors.

I can sumproduct to find who donated in both. I'm having difficulty in finding who donated in the first year but did NOT donate in the second.

For example if my first year is 2018 and 2017 is the second and looking the City of Dallas I should only find those that are starred which should return a sum of $70 and a count of unique donors as 2

The logic is to find all donations in dallas, then find all who donated in 2018 but not in 2017.

I have a feeling this is a complicated, nested sumproduct but I'm stumped. Any pointers are much appreciated.

All values in any column are not necessarily unique.

DonorIDCityYearDonation
10San Antonio2018$10
10San Antonio2018$20
20Dallas2017$30
20Dallas2018$40
20Dallas2019$40
40Dallas2018$20*
50San Antonio2018$30
50Dallas2017$30
60Dallas2018$30*
60Dallas2018$20*
60San Antonio2018$50
 
I would think the logic would be something along the lines of;

For a given city:

Array1: Take the array of donors who gave in 2018 (first year) and 2017 (second year)

Array2: Take the array of donors who gave in 2017 (second year)

"Subtract" array 2 from array 1 leaving only those who gave only in 2018. Not sure how to do this.

Using the resultant array add up all the donations to get sum of donations and use the size of the array to get number of donors.

I just can't translate this to Excel-speak.
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try:

Book1
ABCDEFGHIJK
1DonorIDCityYearDonation
210San Antonio201810Year1Year2CityUnique Donor in 2018 Not in 2017Sum
310San Antonio20182020182017Dallas270
420Dallas201730
520Dallas201840
620Dallas201940
740Dallas201820
850San Antonio201830
950Dallas201730
1060Dallas201830
1160Dallas201820
1260San Antonio201850
Sheet32
Cell Formulas
RangeFormula
J2J2="Unique Donor in "&G3&" Not in "&H3
J3J3=SUM(SIGN(FREQUENCY(IF(B2:B12=I3,IF(C2:C12=G3,IF(ISERROR(MATCH(A2:A12&"|"&H3,A2:A12&"|"&C2:C12,0)),MATCH(A2:A12,A2:A12,0)))),ROW(A2:A12)-ROW(A2)+1)))
K3K3=SUM(IF(B2:B12=I3,IF(C2:C12=G3,IF(ISERROR(MATCH(A2:A12&"|"&H3,A2:A12&"|"&C2:C12,0)),D2:D12))))
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.


This might come up with some confusing results, based on your sample. Donor 50 is in Dallas and San Antonio, so that donor will show up in the totals for both cities.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top