Increment Year in IF statement

fengliangduck

New Member
Joined
Aug 1, 2022
Messages
2
Office Version
  1. 365
Hi,
I have a following IF statement and I totally enter 12 months manually 01-2022, 02-2022 ..... 12-2022. But, how to make year increment automatically. For example, IF "02-2022","02/28/2022". IF "02-2023","02/28/2023". IF "02-2024","02/28/2024". In short, I like to have this 202X and X will automatically change. Thank you !
=if(A1="02-2022","02/28/2022",If(A1="01-2022","01/31/2022,"0'))
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Rather than using an IF statement, perhaps try

=EOMONTH(A1,0)

That will return the last day of the month referenced in cell A1, regardless of year. Format the cell with the formula as a date, of course.
 
Upvote 0
Solution

Forum statistics

Threads
1,216,460
Messages
6,130,771
Members
449,589
Latest member
Hana2911

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