function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hadeel MamdouhHadeel Mamdouh 

Write formula for YearMonth both in 2 digits each?


Hello,

I am trying to create a formula for YearMonth, both 2 digits each to add it to a serial number.

I found this formula and another one that removes the space between Year and Month, but I can't find a way to make the year show as "18" instead of "2018":

Text(YEAR(Datevalue(CreatedDate)))+" "+CASE( 
MONTH(Datevalue(CreatedDate)), 
1, "01", 
2, "02", 
3, "03", 
4, "04", 
5, "05", 
6, "06", 
7, "07", 
8, "08", 
9, "09", 
10, "10", 
11, "11", 
12,"12", 
"")

Help?
Best Answer chosen by Hadeel Mamdouh
Alain CabonAlain Cabon
Hi,

RIGHT ( Text(YEAR(Datevalue(CreatedDate))) , 2 )

RIGHT(text, num_chars) and replace text with the field or expression you want returned; replace num_chars with the number of characters from the right you want returned.

 

All Answers

Alain CabonAlain Cabon
Hi,

RIGHT ( Text(YEAR(Datevalue(CreatedDate))) , 2 )

RIGHT(text, num_chars) and replace text with the field or expression you want returned; replace num_chars with the number of characters from the right you want returned.

 
This was selected as the best answer
Akshay_DhimanAkshay_Dhiman
Hi Hadeel,

Try this way out for removing first two digit,

Formula --
 
Text(RIGHT(YEAR(Datevalue(CreatedDate))),2)+" "+CASE( 
MONTH(Datevalue(CreatedDate)), 
1, "01", 
2, "02", 
3, "03", 
4, "04", 
5, "05", 
6, "06", 
7, "07", 
8, "08", 
9, "09", 
10, "10", 
11, "11", 
12,"12", 
"")



RIGHT(text, num_chars) and replace text with the field or expression you want to be returned; replace num_chars with the number of characters from the right you want returned.

Thanks 
Akshay
Hadeel MamdouhHadeel Mamdouh
Am a newbie at formulas, your understanding of what goes where in a formula is admirable lol
Thanks a lot for your help, very much appreciated.