Problem to solve:
Given 2 rows, containing the author's name and a date, you have to count how many rows that author has.
The tricky part here is that I have to use the date row and check how many entries does that author have within the week of that date he entered.
What my data looks like:
Expected output:
Let's hypothetically say that today is the 19th of February and it's a Friday.
I need to count each row that has a date between 15th of February (Monday) and 21st of February (Sunday).
Next week, from 22nd of February, I need to start it over and check it again for that week and so on.
So, I'm trying to better understand how to approach a simple / stupid problem that I can't find a solution to it.
I've been messing around with the QUERY() function but with no luck since I have literally no idea what lead to follow.
Best Answer
EDIT
(based on OP's comment)
Use the following formula
The trick here is the creation of a virtual array holding the week-number.
If you want to just group them based on weeks, just omit the
and
clauseand Col3="&WEEKNUM(TODAY(),2)&"
(Do not forget to adjust for your locale. If still in trouble please read how to and share a test sheet so as you can be easier helped.)
ORIGINAL ANSWER
Please use the following QUERY formula
(I believe your image of shown expected result is wrong since it just counts all values and is not based on the dates within the current week)
Functions used:
QUERY
ArrayFormula
WEEKNUM