grouping a data set based on working weeks and unique dates

pma111 used Ask the Experts™
I have a rather substantial txt file which represents login/lock/unlock/logoff actions for one of our employees in a specific application. I want to import the data into Access or Excel (dependant on the best tool for the job) to get some stats from the data. There can be numerous entries for every working day to represent the times an officer has logged into, logged off from, locked and unlocked there account in a specific application. However, I need a report from all the data which shows how many unique days there are in the logs with any level of activity, for each 'week' - by which I am classifying that as a week commencing from and including Monday, to and including Sunday, e.g. Monday - Sunday, so this week would be 01-Oct-2018 - 07-Oct-2018, and next week would be 08-Oct-2018 - 14-Oct-2018.

For example if for the week commencing 01-Oct-2018 - 07-Oct-2018, there were rows of data on say the 1st, 3rd and 5th October, the end result for that week would be 3 days, as there were 3 unique dates listed in the logs. I should point out there is not 1 row of data per date, as if there were numerous login/lock/unlock/logoff actions for a date, each of these actions creates a row of data, so 01-Oct-2018 could have 2 rows in the dataset, or it could have 15. Struggling to find the best solution to get the information required, especially how to group them into how many unique dates there are listed as rows in the logs for each week commencing block (unless excel or access has a specific function for grouping weeks based on Monday-Sunday calendar dates).
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Access is more flexible for such tasks. You can select officer, date and group by these fields. In next query you can count dates for each week


I did think it may require a staggered approach, with a couple of processes.

>In next query you can count dates for each week

Do you have any examples e.g. a standard function which calculates all entries for a week based on Monday-Sunday.
Can you upload small sample of text file? Sequental queries are normal for Access
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!


It really is as simple as a comma separated file, whereby a standard set of data would be (there are other rows but they are irrelevant for what I need). It is sequential in that it lists all users actions in chronological order, not just for each individual.

date, time, officer, action
01/08/2018, 16:14, userB, logon
01/08/2018, 16:25, userB, logoff
02/08/2018, 15:15, userA, logon
02/08/2018, 15:50, userA, lock
02/08/2018, 15:55, userA, unlock
02/08/2018, 16:35, userA, logoff
Play with this sample. Data are imported to table A, open Query2 for testing
Rob HensonFinance Analyst

How about using a Pivot Table???

If you upload some sample data, maybe 100 rows, and show what result you would like to see then I can take a look.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial