Add 1 Year to Date string stored as text (only if the month is Jul thru Dec); Display as Text

MikeL

Active Member
Joined
Mar 17, 2002
Messages
488
Office Version
  1. 365
Platform
  1. Windows
Hello,

07-JUL-19 should return 'JUL-20' (not date formatted as text but as actual text.

22-MAY-19 should return MAY-19


05-JAN-20 should return 'JAN-20'


-- So only add 1 year to date if months are either JUL, AUG, SEP, OCT, NOV, DEC.
-- The string is a date stored as text ie DD-MMM-YY
-- The final result should be a text string (ie JUL-20, MAY-19, etc.) The idea is that this result is no longer a date.


Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Probably a better way, but this to work.

Book1
AB
107-Jul-19Jul-20
222-May-19May-19
305-Jan-20Jan-20
405-Nov-20Nov-21
504-Apr-19Apr-19
Sheet2
Cell Formulas
RangeFormula
B1:B5B1=TEXT(MONTH(A1)&"-"&IF(ISNUMBER(MATCH(MONTH(A1),{7,8,9,10,11,12})),YEAR(A1)+1,YEAR(A1)),"mmm-yy")
 
Upvote 0
Or :
=LEFT(A1,4) & RIGHT(A1,2)+(MONTH(DATEVALUE(A1))>6)
 
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

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