Date function not rolling to next year

sheller

New Member
Joined
Dec 12, 2016
Messages
22
Hi Excel wizards,
I have a date formula that is working in all ways except near year-end, when instead of rolling to the next year, it rolls back to the current year. I feel like I'm just missing one small part of the formula, but can't figure it out. Any help appreciated. Thank you!

Formula in cell I2 of the image is as follows: =DATE(YEAR([@[ES_ETA]]), MONTH(EOMONTH([@[ES_ETA]], (DAY([@[ES_ETA]])>25)+1)),1)
 

Attachments

  • 2021-11-29 13_00_54-Book3 - Excel.png
    2021-11-29 13_00_54-Book3 - Excel.png
    8.4 KB · Views: 7

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Toadstool

Well-known Member
Joined
Mar 5, 2018
Messages
2,549
Office Version
  1. 2016
Platform
  1. Windows
Hi Sheller,

The YEAR is always that in ES_ETA but you add to the months so the year should change.

I'm not sure why your first two rows should be the 2nd of the month so can you explain or does this do what you ask?

Sheller4.xlsx
HIJ
1ES_ETAES_AVAIL_WHSENOTES
205-Dec-2101-Jan-22
328-Dec-2101-Feb-22
405-Nov-2101-Dec-21
Sheet1 (3)
Cell Formulas
RangeFormula
I2:I4I2=EOMONTH([@[ES_ETA]],(DAY([@[ES_ETA]])>25)+0)+1
Named Ranges
NameRefers ToCells
'Sheet1 (3)'!ES_ETA='Sheet1 (3)'!$H$2:$H$4I2
 

BigBeachBananas

Board Regular
Joined
Jul 13, 2021
Messages
139
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi Excel wizards,
I have a date formula that is working in all ways except near year-end, when instead of rolling to the next year, it rolls back to the current year. I feel like I'm just missing one small part of the formula, but can't figure it out. Any help appreciated. Thank you!

Formula in cell I2 of the image is as follows: =DATE(YEAR([@[ES_ETA]]), MONTH(EOMONTH([@[ES_ETA]], (DAY([@[ES_ETA]])>25)+1)),1)
Try:
Book2
AB
112/5/20211/1/2022
212/28/20212/1/2022
311/5/202112/1/2021
Sheet1
Cell Formulas
RangeFormula
B1:B3B1=IF(DATE(YEAR(A1), MONTH(EOMONTH(A1, (DAY(A1)>25)+1)),1)<A1,DATE(YEAR(A1)+1, MONTH(EOMONTH(A1, (DAY(A1)>25)+1)),1),DATE(YEAR(A1), MONTH(EOMONTH(A1, (DAY(A1)>25)+1)),1))
 
Solution

sheller

New Member
Joined
Dec 12, 2016
Messages
22
Hi Sheller,

The YEAR is always that in ES_ETA but you add to the months so the year should change.

I'm not sure why your first two rows should be the 2nd of the month so can you explain or does this do what you ask?

Sheller4.xlsx
HIJ
1ES_ETAES_AVAIL_WHSENOTES
205-Dec-2101-Jan-22
328-Dec-2101-Feb-22
405-Nov-2101-Dec-21
Sheet1 (3)
Cell Formulas
RangeFormula
I2:I4I2=EOMONTH([@[ES_ETA]],(DAY([@[ES_ETA]])>25)+0)+1
Named Ranges
NameRefers ToCells
'Sheet1 (3)'!ES_ETA='Sheet1 (3)'!$H$2:$H$4I2
Thank you so much! This is exactly what I was looking for, and the 2nd of the month was a typo on my end (and should have been the first). Thanks again!
 

Toadstool

Well-known Member
Joined
Mar 5, 2018
Messages
2,549
Office Version
  1. 2016
Platform
  1. Windows
Thank you so much! This is exactly what I was looking for, and the 2nd of the month was a typo on my end (and should have been the first). Thanks again!
You're welcome and thanks for the feedback.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,477
Messages
5,831,909
Members
430,090
Latest member
bjonesh2o

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
Top