Count in a query

DavidAC

Board Regular
Joined
Feb 10, 2003
Messages
134
Office Version
  1. 365
hi,
hope you can help. i have a query from which i want to produce 3 forms of counts using the same criteria. The counts are as follows
1) count order numbers where the date completed is null
2) count order numbers where the date completed is NOT null
3) count total order wheather the date is null or not.

the only fields i have in the query are order number and date_completed. any help would be appreciated as i am tearing what little hair i have left out. :pray:
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
This can't be done with only one query.

You need at least two.

Create a new query add the order number field and the date completed field.

Right click and select totals.

Select Count from the Total dropdown for order number field.

For the date completed field set the criteria to Is Null and select Where from the Total dropdown.

Run the query and you should have a count of orders with no date completed.

To count total orders just remove the Is Null from the criteria, or alternately open up the orders table and look at the record number indicator in the bottom left corner.
 
Upvote 0
thanks for your response, what i need to do next is to show these seperate queries in one form is there a way to do this?
 
Upvote 0
If you want them in a form then what you probably want to use is the DCOUNT function.

eg

DCOUNT("[order number]", "Orders", "[date completed] Is Null")
 
Upvote 0
thank you everything appeared to work great however i now have the problem that as soon as a second order is added to the list it returns a #error# value when it should return a number value. Also could you inform me how i only show just one order number rather than all the requests under that number as i only want a summary of the data
 
Upvote 0

Forum statistics

Threads
1,221,798
Messages
6,162,027
Members
451,737
Latest member
MRASHLEY

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