[英]How to convert text “yyyy mmm ABC” to “yyyymm” date format using Excel formula?
Supposing I have cell value equal to假设我的单元格值等于
"2020 Aug ABC"
in Excel.在 Excel 中。
I want to convert this to 202008
date format using an excel formula because I would want to use the output value, that is, 202008 to perform some operation.我想使用 excel 公式将其转换为
202008
日期格式,因为我想使用 output 值,即 202008 来执行一些操作。
If your data is in A1
:如果您的数据在
A1
中:
=LEFT(A1,4) & TEXT((DATEVALUE(MID(A1,6,3) & " 1")),"mm")
=A1&RIGHT("0" & MONTH(DATEVALUE(B1&"1")),2)
=A1&RIGHT("0" & MONTH(DATEVALUE(B1&"1")),2)
Output: Output:
Just another approach if your data is always same pattern.如果您的数据始终是相同的模式,这只是另一种方法。
=TEXT(DATEVALUE("01-"&MID(A1,6,3)&"-"&LEFT(A1,4)),"yyyymm")
A1 = 2020 Aug ABC A1 = 2020 年 8 月 ABC
B1 B1
=LOOKUP(9^9,LEFT(A1,4)/1%+FIND(TEXT(ROW($1:$12)*28,"mmm"),A1)^0*ROW($1:$8))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.