Return on data where day of week matches dates in a table

liammoohan

Board Regular
Joined
Jan 11, 2008
Messages
72
I have a list of dates for the current month with volume of records on each day.

I need to query the data but only return all records wher the current day of the week is the same as the date.

i.e today 15/04/2016 = Friday so I only want the query to return data for the following dates:

01/04/2016
08/04/2016
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Something like this could work for you:

ABCD
1
2Date
3DateVolume4/15/2016
44/1/20161
54/2/20162Sum of Fridays
64/3/2016324
74/4/20164
84/5/20165
94/6/20166
104/7/20167
114/8/20168
124/9/20169
134/10/201610
144/11/201611
154/12/201612
164/13/201613
174/14/201614
184/15/201615
194/16/201616
204/17/201617
214/18/201618
224/19/201619
234/20/201620
24

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet6

Worksheet Formulas
CellFormula
D3=TODAY()
D5="Sum of "&TEXT(D3,"dddd")&"s"
D6=SUMPRODUCT((WEEKDAY(A4:A23)=WEEKDAY(D3))*B4:B23)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



I just used TODAY() in D3, but you can put any date in there. The formula in D6 actually calculates the sum. In this example, it sums up 1, 8, and 15. There is no provision for excluding dates before or after any particular times, but those can be added as needed.

Let me know how this works for you.
 
Upvote 0
Eric, not sure if you realize, but this question was posted in the Access forum (if you are using the Zero Reply Posts listing, be sure to look over all the way to the right to see which forum the question is in).

Here is you Access solution:
- In your query, create a calculated field and set it equal to this:
Code:
Weekday([[I]DateField[/I]])
where DateField is the name of your Date field
- On the Criteria row of this calculated field, enter the following:
Code:
Weekday([Date])
- If you do not want to see this value return in your query output, simply uncheck the "Show" box (then it just uses the calculation without showing it to you)
 
Upvote 0

Forum statistics

Threads
1,221,819
Messages
6,162,155
Members
451,749
Latest member
zack_ken

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