Round Date to Nearest January

chet645

Board Regular
Joined
Nov 10, 2010
Messages
67
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

I am wondering how to use a dynamic formula that rounds a given date to the nearest January month. For example, If I have two dates that I want to round (3/31/2020 and 10/31/2020), the formula would calculate the fist date as 1/31/2020 and the second date to 1/31/2021.

Your help is much appreciated.

Chet
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Book1
FGHI
1
231/03/202030/09/2020
3
431/01/202031/01/2020
5
Sheet5
Cell Formulas
RangeFormula
G4:H4G4=IF((G2-DATE(YEAR(G2),1,31))<(DATE(YEAR(G2),1,31)-G2),DATE(YEAR(G2),1,31),DATE(YEAR(G2),1,31))
 
Upvote 0
Thank you CA_Punit, but I would like the formula to round cells G2 and H2 to the nearest January date. So, cell H2 should round to 31/01/2021.
 
Upvote 0
Upvote 0
Hello, I tried solving your problem, hope it helps you. just one modification is the row in which you will be extracting the nearest January date, you have to specify the number formatting as the date. other than that the formula will work well, I suppose.
Book1
AB
110-01-202010-01-2020
211-01-202111-01-2021
331-01-202031-01-2020
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=IF(MONTH(A1)<7,DATE(YEAR(A1),1,DAY(A1)),DATE(YEAR(A1)+1,1,DAY(A1)))
 
Upvote 0
I thought you wanted only 31/01/2020 or 31/01/2021

Anyway i have modified
=DATE(YEAR(IF((I7-DATE(YEAR(I7),1,1))>=(DATE(YEAR(I7)+1,1,1)-I7),DATE(YEAR(I7)+1,1,31),DATE(YEAR(I7),1,31))),1,DAY(I7))
 
Upvote 0
A simpler version of my formula from post#4
=EDATE(I7,IF(MONTH(I7)<7,1,13)-MONTH(I7))
 
Upvote 0
How about
+Fluff New.xlsm
IJ
705/01/202005/01/2020
802/02/202002/01/2020
901/03/202001/01/2020
1029/03/202029/01/2020
1126/04/202026/01/2020
1224/05/202024/01/2020
1321/06/202021/01/2020
1419/07/202019/01/2021
1516/08/202016/01/2021
1613/09/202013/01/2021
1711/10/202011/01/2021
1808/11/202008/01/2021
1906/12/202006/01/2021
2003/01/202103/01/2021
2131/01/202131/01/2021
Data
Cell Formulas
RangeFormula
J7:J21J7=EDATE(I7,IF(MONTH(I7)<7,-MONTH(I7)+1,13-MONTH(I7)))
Learned the new trick today. Thank you so much.
 
Upvote 0
T202008a.xlsm
AB
17-Aug-2001-Jan-2021
201-Jan-2021
3
5a
Cell Formulas
RangeFormula
B1B1=DATE(YEAR(A1)+(YEARFRAC(DATE(YEAR(A1),1,1),A1)>0.5),1,1)
B2B2=DATE(YEAR(TODAY())+(YEARFRAC(DATE(YEAR(TODAY()),1,1),TODAY())>0.5),1,1)
 
Upvote 0
A simpler version of my formula from post#4
=EDATE(I7,IF(MONTH(I7)<7,1,13)-MONTH(I7))
Hello, EDATE will also require to convert the number formatting manually to date, is there any function which in spite of providing the serial number of date provides the exact date.
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,777
Members
449,049
Latest member
greyangel23

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