Returning a count/sum based on mulitple criteria

AliG999

New Member
Joined
Nov 6, 2017
Messages
20
First time poster

I hope you can help. I have data which is broken down per year for which I need to return a count against each unique ID but in which there may be multiple rows linked to that ID but I would like a unique count and in some cases a sum of and want to avoid duplicate counts. the data looks something like below:

YearUnique IDCase No.GenderNo. of SalesTotal No. of Cases per unique ID
2012E542123Female23
2012E542589Male13
2012E542123Female23
2013E588235Male33
2013E588415Male13
2013E588256Female23

<tbody>
</tbody>


For e.g. I would like to count for 2012 how many females/males per unique ID (to avoid duplication in counting the same individuals more than once)

Or I may wish to sum how many sales per unique ID for each year.

I have tried all sorts of COUNT IF/S or SUM/IFs variations but cannot figure it out - any help would be gratefully appreciated.

thanks

Ali
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
First time poster

I hope you can help. I have data which is broken down per year for which I need to return a count against each unique ID but in which there may be multiple rows linked to that ID but I would like a unique count and in some cases a sum of and want to avoid duplicate counts. the data looks something like below:

YearUnique IDCase No.GenderNo. of SalesTotal No. of Cases per unique ID
2012E542123Female23
2012E542589Male13
2012E542123Female23
2013E588235Male33
2013E588415Male13
2013E588256Female23

<tbody>
</tbody>


For e.g. I would like to count for 2012 how many females/males per unique ID (to avoid duplication in counting the same individuals more than once)

Or I may wish to sum how many sales per unique ID for each year.

I have tried all sorts of COUNT IF/S or SUM/IFs variations but cannot figure it out - any help would be gratefully appreciated.

thanks

Ali

Assuming the Columns ranges are from A to F

=SUMPRODUCT(--($A$2:$A$7=2012),--(MATCH($B$2:$B$7&$D$2:$D$7,$B$2:$B$7&$D$2:$D$7,0)=ROW(INDEX($B$2:$B$7,0,0))-ROW($A$2)+1))
 
Upvote 0
Thanks Vane

I've used the formula you suggested on my actual datasheet =SUMPRODUCT(--('TELECOMS REQUESTS'!$A$3:$A24=2012),--(MATCH($B$3:$B$24&$AE$3:$AE$24,$B$3:$B$24&$AE$3:$AE$24,0)=ROW(INDEX($B$3:$B24,0,0))-ROW($A$3)+1))

The only thing is it returns a value of 7 however when I do a check using a pivot table it should be 9 - have I done something wrong?
 
Upvote 0
Apologies Vane

It did work I just forgot to add in the sheet name for the ranges - dafty! Been a long day trying to figure this out. Can I ask for an idiots explanation of the above formula?

Thanks again for all your help

ali
 
Upvote 0

Forum statistics

Threads
1,215,777
Messages
6,126,835
Members
449,343
Latest member
DEWS2031

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