Forum Discussion
TerriLP
Dec 01, 2023Copper Contributor
Count the instances of a name based on the date, into a different sheet
Greetings. I am trying to set up a spreadsheet that tracks productivity for staff using Office 365. I am working with 2 spreadsheets in the workbook. The first sheet is named "FACILITY REQUESTS". ...
- Dec 01, 2023
Hi TerriLP
If I didn't make mistake replicating your setup that should be:
in B2 then copy right & down (adjust $G$100 and $B$100 according to your actual ranges):
=COUNTIFS( 'FACILITY REQUESTS'!$G$1:$G$100, $A2, 'FACILITY REQUESTS'!$B$1:$B$100, ">=" & B$1, 'FACILITY REQUESTS'!$B$1:$B$100, "<=" & EOMONTH(B$1,0) )
NB: Enter real dates (1/1/24, 1/2/24,....1/12/24) in B1:M1 then Custom Format cells to display Month names only
mtarler
Dec 01, 2023Silver Contributor
data validation is a very good thing.
It sounds like a Pivot Table might be exactly what you need.
your rows would be user names
then add date to columns and that should auto create months and other break downs (get rid of the ones you don't want. probably just keep years if included and months)
then add names to Values box also
here is a screenshot example
TerriLP
Dec 01, 2023Copper Contributor
Thank you both for your super fast replies. I did try both ways and both work to a degree.
Lorenzo Your way seemed to work best for me except as far as I can tell I would need a column for every day of the year. Is that right, or is there a way to put a month's worth of dates into one cell?
mtarler I have only used a very simple Pivot table once and it was many years ago so I'm probably missing some important knowledge and a quick internet search wasn't super helpful. As with LZ's method, I don't see a way to display the total for the entire month rather than for each day of the month. In addition, I don't see that the table updates in real time, which is very important. I am not the person who will be gathering the information from the totals sheet so it needs to be ready whenever she needs it.
Again, I thank you both for taking the time and for being so quick about it as well.
- LorenzoDec 02, 2023Silver Contributor
I would need a column for every day of the year. Is that right, or is there a way to put a month's worth of dates into one cell?
I'm afraid I don't understand. Either it's me who don't understand your setup and/or what your process is to "fill" 'FACILITY REQUESTS' or you didn't provide the right picture 🙂 if I may
So, if what appears to be best in your contex (dynamic reporting) is doable with what I suggested, fine (there's something even more dynamic below given you run 365). Otherwise please post a couple of pictures of your actual setup and explain how Sue, Paul... record info. in 'FACILITY REQUESTS' (I suppose) and when (every day, hour...)
365 option - Same as what I shared earlier but no more copy right, down...:
where TotalFacilityRequests is a LAMBDA function defined in Name Manager to which you pass the Year (in C2 above) you want to report on. To experience it enter 2025 in C2 in the attached file and/or add a new name(s) at the bottom of table Employee in sheet 'PARAM'
NB: I used Tables as they offer (amongst other benefits) dynamic ranges. That's not mandatory but recommended 🙂
- TerriLPDec 02, 2023Copper Contributor
HiLorenzo Thank you for replying. It was my spreadsheet that was bugged, not your solution. Once I recreated the spreadsheet from scratch, your original solution worked flawlessly. Thank you! Sorry for the confusion.
- mtarlerDec 02, 2023Silver ContributorI'm very happy it is working. My guess on the 'bug' was a formatting issue. If the Dates were actually text or included text that could throw things off since you don't get a date RANGE when looking at ascii text but that is just a guess
- mtarlerDec 01, 2023Silver Contributor
you're very welcome.
In both cases you should be getting monthly totals.
In Lz's case the COUNTIFS statement uses 3 conditions, the 1st is based on being the correct name, the second is >= B$1 which is the top of the column and although all you see is the month name it is really the 1st day of that month and then 3rd is <=EOMONTH() which is the end of that monthIn the Pivot Table, I noted you should drag the Date to the Columns box which should automatically create multiple items including MONTH. By leaving MONTH in there (and removing Day and Date) you will see the totals by month. Basically what I'm saying is that when I dragged "date" to the Columns box then EXCEL created Days(date) and Months(date) items.
- TerriLPDec 01, 2023Copper ContributorHow interesting. I tried a couple more times to get the results that you said I should, but it just would NOT give me more than one day's results. So I recreated the spreadsheet from scratch and pasted in information from our live workbook.. perfect! Both solutions. I'm not sure what's breaking the original. I did try a lot of different things before asking for help. There's a high chance that I accidently changed the date format on Facility Requests at some point.
Whatever the cause, I'm extremely grateful that you've saved us a ton of time. Thank you, both of you!