Can query Assign on-or off-quarter based on date value?

dls0406

New Member
Joined
Oct 7, 2019
Messages
15
I have a table which includes
Column 1: Client Name
Column 2: Project date (Must be last day of month)

The unique ID is a combination of column A and Column B. So, there may be multiple instances of the same client with different project dates.

I want to create a query that looks at the project dates and can tell me, by looking at the month, if the client has project dates that are on-quarter end (3/31, 6/30, 9/30 or 12/31) or not.

In an ideal world, I would have a query which lists all clients (1 row per client) and identifies them as either on-quarter or off-quarter.

Any suggestions for how to go about this?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I guess you will just put in your where criteria just as stated:

Code:
select * from Table1 where 
	(
	(datepart("m", [Project date]) = 3 and datepart("d", [Project date]) = 31)
	or 	
	(datepart("m", [Project date]) = 6 and datepart("d", [Project date]) = 30)
	or 	
	(datepart("m", [Project date]) = 9 and datepart("d", [Project date]) = 30)
	or 	
	(datepart("m", [Project date]) = 12 and datepart("d", [Project date]) = 31)
	)

equivalent with only two lines instead of four:
Code:
select * from Table1 where 
	(
	(datepart("m", [Project date]) in (3, 12) and datepart("d", [Project date]) = 31)
	or 	
	(datepart("m", [Project date]) in (6, 9) and datepart("d", [Project date]) = 30)
	)
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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