Expression Challenge

Tom Vert

New Member
Joined
Oct 30, 2004
Messages
43
My database is based on one table which includes the numeric field Action, and the date fields, DateIn and DateOut. Action is a 6-digit number that can be considered a work order and remains the same until the action is finalized. When an action comes into our office, we record the DateIn, and when it is complete, we record DateOut. Sometimes we need to return the action to the originator (sometimes more than once), in which case both DateIn and DateOut are recorded, before we can finalize it. We run several reports based on these dates.

Here's my problem: In some reports, I want a control to count only the most recent action (see red entry below) when DateOut is null. How do you create an expression in the report that ignores earlier 'DateOut' dates (is not null) and only applies the expression to the most recent action where DateOut is null? Is there a variation of the count function that would help me to count only the most recent action that has no DateOut? Thanks much for the help.

DateIn DateOut

1 May 07 4 May 07
5 May 07 6 May 07
7 May 07 Is Null
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,437
Hi Tom

DCount doesn't work with null values very well so you need to use another function (e.g. the nz function) to convert the null value to something else. I tested this in an unbound text box in a report and it returned the correct value:

=DCount("[MyKeyField]","MyTable","Nz([MyDateField],0) = 0")

Make sure you use your actual field and table names.

HTH, Andrew
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,094
Messages
5,768,051
Members
425,451
Latest member
JohnBrooksBiddle

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
Top