youreskimofriend
New Member
- Joined
- Aug 20, 2013
- Messages
- 3
Hey everybody,
I already managed to almost solve my problem with putting together a rather long formula from existing threads but when it comes to those ranges I give up.
I have a very large data set (30k rows, no blanks) and I am trying to count distinct account numbers based on two criteria but one should capture a range.
This is a simplified version:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Account Nr.[/TD]
[TD]Country[/TD]
[TD]Age of purchase (years)[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]USA[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]USA[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]234[/TD]
[TD]USA[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]234[/TD]
[TD]USA[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]345[/TD]
[TD]Germany[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]
The question I am trying to answer is: How many clients from the USA have purchased something 1-3 years or 3-5 years ago. How many clients from Germany, etc.
I was able to figure out the formula for each individual year, but not the ranges. E.g. for year 2 I can get the distinct US clients like this:
=SUM((IF((C2:C6=2)*(B2:B6="USA")*(A2:A6<>"");1/COUNTIFS(A2:A6;A2:A6;C2:C6;2;B2:B6;"USA";A2:A6;"<>"))))
Any help is greatly appreciated!
Andi
I already managed to almost solve my problem with putting together a rather long formula from existing threads but when it comes to those ranges I give up.
I have a very large data set (30k rows, no blanks) and I am trying to count distinct account numbers based on two criteria but one should capture a range.
This is a simplified version:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Account Nr.[/TD]
[TD]Country[/TD]
[TD]Age of purchase (years)[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]USA[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]USA[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]234[/TD]
[TD]USA[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]234[/TD]
[TD]USA[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]345[/TD]
[TD]Germany[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]
The question I am trying to answer is: How many clients from the USA have purchased something 1-3 years or 3-5 years ago. How many clients from Germany, etc.
I was able to figure out the formula for each individual year, but not the ranges. E.g. for year 2 I can get the distinct US clients like this:
=SUM((IF((C2:C6=2)*(B2:B6="USA")*(A2:A6<>"");1/COUNTIFS(A2:A6;A2:A6;C2:C6;2;B2:B6;"USA";A2:A6;"<>"))))
Any help is greatly appreciated!
Andi