Formulas of first and last day of each quarterly month.

KyleJackMorrison

Board Regular
Joined
Dec 3, 2013
Messages
107
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hello,

I'm struggling to find a formula that will show the First and Last date of each quarterly month. Basically need to have these dates but for the current year so the year will change if its 2020...

First Quarter:
01/01/2019
31/03/2019
Second Quarter
01/04/2019
30/06/2019
Third Quarter
01/07/2019
30/09/2019
Forth Quarter
01/10/2019
31/10/2019

Thanks in advance.
Kyle
 
Just Put any Year in Sheet1 at A1 and Run the Module

Sub CreatQuaterDates()
'On Error Resume Next
Dim dt As Date: Dim Rng As Range
Dim QM As Long 'FirstMonthInQuarter:
Dim LQ As Long: ' LastMonthInQuarter
Dim oYear As Variant: oYear = Sheet1.Range("A1").Value
Dim YearIn As Long: YearIn = CLng(oYear):

' Validate Year Value
If YearIn = 0 Then Exit Sub
If YearIn > 9999 Or YearIn < 1900 Then Exit Sub

dt = DateSerial(YearIn, 1, 1) 'Creat initial Date of the Year
Set Rng = Sheet1.Range("A2:B13")


' Get Dates of Quaters i is the Quater Index
For i = 1 To 12 Step 3
Rng(i, 1) = "Quater " & Int(i / 3) + 1
Rng(i, 1).Offset(1, 0) = DateSerial(Year(dt), i, 1)
Rng(i, 1).Offset(2, 0) = DateSerial(Year(dt), (Int(i - 1) / 3) * 3 + 4, 0)
Rng(i, 2).Offset(1, 0) = Format(DateSerial(Year(dt), i, 1), "dddd")
Rng(i, 2).Offset(2, 0) = Format(DateSerial(Year(dt), (Int(i - 1) / 3) * 3 + 4, 0), "dddd")
Next
End Sub
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,214,653
Messages
6,120,749
Members
448,989
Latest member
mariah3

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