Get the number of duplicates in each day on selected month

akram-5

Board Regular
Joined
Feb 25, 2012
Messages
123
Office Version
  1. 2019
Platform
  1. Windows
Hi All
Hope everyone is having a good day.
I am posting here after a long time. I couldn't get this figured on my own.

i have a data sheet where employees are conducting different jobs recorded with dates and job details.
These employees gets an allowance based on number of days he completes a job. But NOT how many jobs he did on same day.
A statement is taken end of every month to calculate this allowance.
I have people working on this file from 6 different sites.
So make this calculation easier for them i would like to make a macro/userform where user selects a month and hits generate report and data is filtered by month and copied to another sheet, where the data is again filtered and days counted, where employee entries/jobs in the same day is counted only once.

basically result for Jan 2022 should look like

Date Name Number of Days
24/01/2021 James 2
24/01/2021 Elisa 2
24/01/2021 Dominik 2
24/01/2021 Martin 1


for example, you can notice that Dominik has worked on 3 jobs in this month, but he worked only 2 different days.

Hope you guys can help, the autofilter codes and loops i tried is ****. so i didnt add them here.

thank you.
 

Attachments

  • Capture 1.PNG
    Capture 1.PNG
    58.8 KB · Views: 12

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I am posting here after a long time.
Two things that will help you get faster/better solution in the updated forum:

1. Update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

1643024454042.png



2. We cannot copy your sample data from a picture like that but MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Two things that will help you get faster/better solution in the updated forum:

1. Update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

View attachment 55917


2. We cannot copy your sample data from a picture like that but MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Hi Peter, thanks. updated info as suggested.

Below here is a mini sheet of my data sheet

Book2
ABCDEFGHIJKL
1
2E1T5H8GZS CTTotal TimeEnd timeStart TimeNameDateReport-No#
311W2323KH0:504:203:30James1/16/2022RP-011
43E42324KM0:504:203:30Peter1/17/2022RP-022
541W2324KE0:504:203:30Parker3/16/2022RP-033
67E42325DT0:504:203:30Dominik1/21/2022RP-044
7221W2325DT0:504:203:30Martin2/20/2021RP-055
86E42326KH0:504:203:30Dominik1/21/2022RP-066
93W2329KT0:504:203:30Elisa1/22/2022RP-077
1081E42327DT0:504:203:30Iqbal1/23/2022RP-088
118W2330KE0:504:203:30James1/24/2022RP-099
123E42328KM0:504:203:30Dominik1/25/2022RP-1010
131W2331KH0:504:203:30Martin1/25/2022RP-1111
1479E42329DT0:504:203:30Thomas2/27/2022RP-1212
151W2332DT0:504:203:30Elisa1/25/2022RP-1313
1622E42682DT0:504:203:30Parker1/25/2022RP-1414
17W2330KH0:504:203:30Martin1/25/2022RP-1515
1867E42683KH0:504:203:30Peter4/2/2022RP-1616
191W2331KH0:504:203:30Peter2/1/2022RP-1717
2062E42684KE0:504:203:30Parker2/7/2022RP-1818
21411W2332KM0:504:203:30Parker2/7/2022RP-1919
Month


Results sheet,. Notice the 'number of days' column of Dominik and Martin for which the 3rd filter applied to get how many unique days they worked.

Book2
QRSTUV
24JanuaryMonth
25
26TotalAllowanceNo. of daysTotal JobsName#
27200.00100.0023Dominik1
28200.00100.0022Elisa2
29100.00100.0012Martin3
30200.00100.0022James4
31100.00100.0011Peter5
32100.00100.0011Iqbal6
33100.00100.0011Parker7
Month
Cell Formulas
RangeFormula
Q27:Q33Q27=R27*S27


as i mentioned on my previous post, i would like to create a vba solution for this. cannot risk people messing with formula.
 
Upvote 0
Please help.
any vba suggestion to work around Auto-filtering month, then a loop to check for each date for unique names on that date would help
 
Upvote 0
Problem solved. i changed my order of filtering and copied all data to new sheet for 3rd filter.

Thanks for thinking about helping me. :)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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