Help with a query...

woneal

New Member
Joined
Oct 19, 2006
Messages
2
New to the boad, and need help with running this query.

On the TABLE I have 2 fields to be concerned with


DATE RECEIVED and DATE CLOSED
10/11/06 10/15/06
9/12/06 9/13/06
10/16/06 10/18/06
9/10/06 9/19/06

I need to run a query that can tell me how many items were closed between. .

1-5days= Amount closed between that date range.
6-10days= Amount closed between that date range
<11 = any thing closed 11 days or longer.

So the end rusult might look something like this..

1-5 days 3
6-10 days 1
<11 days 0



I will need to run this query on a weekly basis... Also I have only completed Access level II.... So if you could use layman's terms to help me that would be great. .

Thanks in advance,

Craig
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Craig,
I would do it with two (or three) queries. Here is the first query.
Code:
SELECT DateText.DateReceived, DateText.DateClosed, DateDiff("d",[DateReceived],[DateClosed]) AS DateRange
FROM DateText;
This query will give you the difference between the two dates, which the next query will put into "date categories" that you are looking for
Code:
SELECT IIf(([DateRange]>11),"3 >11",IIf(([DateRange]>=6),"2 6-10","1 1-5")) AS DateCategory, Count(([DateRange])) AS Expr1
FROM Query19
GROUP BY IIf(([DateRange]>11),"3 >11",IIf(([DateRange]>=6),"2 6-10","1 1-5"));
You will notice when you run these two queries that the DateCategories are "1 1-5", "2 6-10", and "3 >11". Each category starts with a 1, 2, or 3 which I put in to get them to sort correctly. Of course I would suggest to remove these "sorting" numbers before presenting the data.
HTH,
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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