12/30/2010 8:16:00 PM 如何用公式转为 年月日时分秒
文本格式的 “12/30/2010 8:16:00 PM” 如何用公式转为 年月日时分秒,如何更简单?上传个样本:
=TEXT((MID(A1,7,4)&"/"&LEFT(A1,5))+RIGHT(A1,10),"e/m/d h:m:ss") =(MID(A1,FIND("/",A1,4)+1,4)&"/"&LEFT(A1,FIND("/",A1,4)-1))+MID(A1,FIND(" ",A1)+1,LEN(A1)-FIND(" ",A1)-2)+(RIGHT(A1,2)="PM")/2
又臭又长,位数一致的可缩 谢谢回复。
原有的是文本格式,不是日期格式。。还要考虑AM PM. 看我的,更长:
=((DATE(RIGHT(MID(N3,1,FIND(" ",N3,1)-1),4),SUBSTITUTE(LEFT(MID(N3,1,FIND(" ",N3,1)-1),2),"/",""),SUBSTITUTE(MID(N3,FIND("/",N3,1)+1,2),"/",""))+SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(MID(N3,FIND(" ",N3,1)+1,20)," ",""),"AM",""),"PM","")*1+IF(IFERROR(FIND("PM",N3,1),0)>0,0.5,0)))
哈哈。 =TEXT(MID(A1,7,4)&"/"&REPLACE(A1,6,5,),"e/m/d h:m:ss") =MID(A1,7,4)&"/"&LEFT(A1,5)&" "&RIGHT(A1,10)还是文本格式的话就更简单了。。。如需转换成时间 =--(MID(A1,7,4)&"/"&LEFT(A1,5)&" "&RIGHT(A1,10)) 再设置单元格格式显示即可!
再或者=TEXT((MID(A1,7,4)&"/"&LEFT(A1,5))+RIGHT(A1,10),"e/m/d h:m:ss AM/PM") 上传了个样本,请试试 上传了个样本,请试试 =(MID(A2,FIND("/",A2,4)+1,4)&"/"&REPLACE(LEFT(A2,LEN(A2)-3),FIND("/",A2,4),5,))+(RIGHT(A2,2)="PM")/2
结合一剑大佬思路改下,略短一点点