Calculate latest quarter end

dgabor

New Member
Joined
Apr 17, 2020
Messages
1
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
Hi All,

In an older thread I have seen the below solution for calculating the latest quarter end from a given date and it seems to work. However, I am not sure how the formula works.

Could you please explain?

=LOOKUP(B1,DATE(YEAR(B1),{1,4,7,10},0))

Thank you!
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Welcome to the forum!

The array constant {1,4,7,10} has the month numbers of January, April, July, and October. When you enter multiple values in an array that usually has 1, Excel will calculate all the values. So DATE will calculate all 4 of these:

DATE(YEAR(B1),1,0)
DATE(YEAR(B1),4,0)
DATE(YEAR(B1),7,0)
DATE(YEAR(B1),10,0)

The day value in DATE is 0 for all four cases, so it calculates the day before if you used 1, or the last day of the previous month. So you'll end up with an array holding the 4 end days of the quarters:

12,31,year-1
3,31,year
6,30,year
9,30,year

Then finally LOOKUP takes the date in B1, and searches for the highest value in that list that is less than B1, which gives you the date you want.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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