Max Date (IF no null values, otherwise, display nulls)

brandon20

Board Regular
Joined
Feb 12, 2014
Messages
203
Hi,


I need to display the max of the date for each Name.
This is would be simple, but I need to add one more condition. Which I am not great at in access.


I need to add the max date by name, IF, there are no null values. If there are null values, I need to display them instead of the Max Date.
Here are my data fields and tables:
[Data].[Name]
[Data].[Current Status]
[Data].[End Date]


Here is an example of what I have

Name

<tbody>
</tbody>
End Date

<tbody>
</tbody>
Current Status

<tbody>
</tbody>
A

<tbody>
</tbody>
10/1/2015

<tbody>
</tbody>
CLOSED

<tbody>
</tbody>
A
9/1/2015

<tbody>
</tbody>
CLOSED
A
8/1/2015

<tbody>
</tbody>
CLOSED
A
7/1/2015

<tbody>
</tbody>
CLOSED
B

<tbody>
</tbody>
OPEN
B10/1/2015CLOSED
B9/1/2015CLOSED
B8/1/2015CLOSED

<tbody>
</tbody>



and this is what I would want to display from this:


NameEnd DateCurrent Status
A10/1/2015Closed
BOpen

<tbody>
</tbody>


Is there an easy way to write an equation in access to do this?
Thank you for any help.
 
Last edited:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Here is a Query that will get you the max date for closed and display the Open

Code:
SELECT Table1.Name, Max(Table1.[End Date]) AS [MaxOfEnd Date], Table1.[Current Status]
FROM Table1
GROUP BY Table1.Name, Table1.[Current Status];
 
Upvote 0
Hi,

Thanks, but that does not display what I am looking for. This query gives me the max date of the closed and also displays the open.

I need the query to display the Closed if and only if there is no Open for that Name in Current Status, If there is an Open, display only the Open.

Thanks again!


Current data displayed:

NameEnd DateCurrent Status
A10/1/2015Closed
AOpen

<tbody>
</tbody>


What I need displayed:


NameEnd DateCurrent Status
AOpen

<tbody>
</tbody>
 
Upvote 0
kind of sounds like a union query

do one query for the closed and one for the open

adjust the "where clause" to limit to what you want
 
Upvote 0
YES! thank you.

I had read about Union queries but just overlooked them quickly.

This worked great and will come in very handy in the future.
 
Upvote 0

Forum statistics

Threads
1,221,841
Messages
6,162,314
Members
451,759
Latest member
damav78

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