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

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,214,943
Messages
6,122,370
Members
449,080
Latest member
Armadillos

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