Sum distinct with multiple conditions

nataliek92

New Member
Joined
Oct 29, 2014
Messages
40
Hello

I am currently using Excel 2010, trying to calculte a sum based on multiple if statements.

I have data similar to the following :

Month \ User ID \ Payment
8 \ 123 \ £20
8 \ 124 \ £5
9 \ 123 \ £15
9 \ 125 \ £22
9 \ 126 \ £3

I would like to count the number of new User ID's each month. In August (8), there were 2 new users. In September (9) there were also 2 new users, as User ID 123 had made a payment in August.

I know how to count the number of distinct users overall, using the following formula :
Code:
=SUM(IF(FREQUENCY($B:$B,$B:$B)>0,1))
This would give the value 4.

I thought I would be able to amend this using a multiple IF statement, i.e.
Code:
=SUM(IF(AND(FREQUENCY($C:$C,$C:$C)>0,$E:$E=7),1))
But this gives the value 0, where I was expecting 2.

Basically I'm looking for a way to count the distinct User IDs in each month.

Does anyone know how to do this? Or could anyone offer any advice? It seems like it should be such a simple equation...

Thank you in advance,

Natalie
 
Hi.

Is there any chance you could re-do your example so that it includes a few more rows' worth of data? At the moment, it's difficult to understand your desired output: for one thing, in your example, each UserID occurs precisely once only in a given month. If it's actually possible that a given UserID can occur multiple times in a given month, could you amend the example to reflect this, and also indicate your desired results?

Regards
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Maybe...

A1:G6

Month
User ID
Payment
8
123
20
8
2
8
124
5
9
2
9
123
15
9
125
22
9
126
3

<TBODY>
</TBODY>

G2, confirmed with CONTROL+SHIFT+ENTER, and copied down:

<F2,$B$2:$B$6),0)),MATCH("~"&$B$2:$B$6,$B$2:$B$6&"",0))),ROW($B$2:$B$6)-ROW($B$2)+1)>=SUM(IF(FREQUENCY(IF($A$2:$A$6=F2,IF(ISNA(MATCH($B$2:$B$6,IF($A$2:$A$6 < F2,$B$2:$B$6),0)),MATCH("~"&$B$2:$B$6,$B$2:$B$6&"",0))),ROW($B$2:$B$6)-ROW($B$2)+1)>0,1))

Hope this helps!</F2,$B$2:$B$6),0)),MATCH("~"&$B$2:$B$6,$B$2:$B$6&"",0))),ROW($B$2:$B$6)-ROW($B$2)+1)>
 
Upvote 0

Forum statistics

Threads
1,215,479
Messages
6,125,043
Members
449,206
Latest member
Healthydogs

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