COUNTS Given Criteria

erahi

New Member
Joined
Jul 9, 2012
Messages
9
I have data that shows the all the store visits made by each person with their timestamps.
In Column A I have the Person ID and column B is the timestamp of the visit (e.g. 23/4/2017)
<strike></strike>

I need a formula that will work out the following in two separate columns:

- A person who has made at least 1 visit in a 6 month period
- A person who has made 6 or more visits in a 3 month period

I'm guessing I would need a COUNTIFS with an IF formula....
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi erahi,


I've made Start Date cells in F2 & G2 so you can control when your 3 or 6 month period starts, then enter and drag the Countifs down your ID list Column C as per below;
cnqcT3C



In D1
Code:
=EOMONTH(F2,2)

*This adds the last date 3 months after your start date "F2"

MAdjzRq


In E1
Code:
=EOMONTH(G2,5)

*This adds the last date 6 months after your start date "G2"

In the 3 month Column D

Code:
=IF(COUNTIFS($A$2:$A$29,C2,$B$2:$B$29,">="&$F$2,$B$2:$B$29,"<="&$D$1)>=6,COUNTIFS($A$2:$A$29,C2,$B$2:$B$29,">="&$F$2,$B$2:$B$29,"<="&$D$1),"")

In the 6 month Column E

Code:
==IF(COUNTIFS($A$2:$A$29,C3,$B$2:$B$29,">="&$G$2,$B$2:$B$29,"<="&$E$1)>1,COUNTIFS($A$2:$A$29,C3,$B$2:$B$29,">="&$G$2,$B$2:$B$29,"<="&$E$1),"")
 
Last edited:
Upvote 0
Hello, this isnt quite what I was after. The problem is that the start date and end date are not fixed - it could be any date. I need to know which person has made 6+ visits within any 3 month period

I realised this is quite a complicated calculation.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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