Hello people
I got this string "2015-07-22"
but I just want to have 07
Could someone help me with a code?
Thank you in advance
Printable View
Hello people
I got this string "2015-07-22"
but I just want to have 07
Could someone help me with a code?
Thank you in advance
This is how I arrived at a solution but then I tend to do things backwards.... Assuming the string is in A1 and formula is in A2
=Right(Left(A1,7), 2)
Others though would use the Mid function
=Mid(A1,6,2)
Which Excel would prefer.
Looks very much like a date.
=MONTH(A1)
If it is text, try
=TRIM(MID(SUBSTITUTE(A1,"-",REPT(" ",999)),999,999))
Where you have "07", it can be any length between "-"'s
If it is a date, then use =Text in a UDF or Format() in a VBA solution. For the former: =TEXT(A1, "MM")