将字符串转换为Excel中的日期 [英] Converting String to Date in Excel

查看:132
本文介绍了将字符串转换为Excel中的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的日期字符串格式如下:2012年1月3日星期二



如何在Excel 2010中以日期格式转换? / p>

提前谢谢!

解决方案

设置。如果您有美国区域设置,此公式将根据您在A1中的数据给出一个日期



= TRIM(REPLACE(A1,1,FIND ,,A1),))+ 0



所需日期格式的格式



此版本应该在更广泛的范围内工作.....



= TRIM(MID(A1,LEN(A1) -7,2)& REPLACE(REPLACE(A1,LEN(A1)-7,3,),1,FIND(,,A1),))+ 0



尝试这个适用于意大利语设置的版本 - [我假设数据为英文,如图所示,例如月份是1月,2月等。]



= DATE(RIGHT(A1; 4); SEARCH(MID(A1; FIND( ; A1)+2; 3);xxjanfebmaraprmayjunjulaugsepoctnovdec)/ 3; MID(A1; LEN(A1)-7; 2))


I've got date strings formatted this way: "Tuesday, January 3, 2012"

How can I convert them in a date format in Excel 2010?

Thank you in advance!

解决方案

What works can depend on regional settings. If you have US regional settings this formula will give a date based on your data in A1

=TRIM(REPLACE(A1,1,FIND(",",A1),""))+0

format in required date format

This version should work on a wider range.....

=TRIM(MID(A1,LEN(A1)-7,2)&REPLACE(REPLACE(A1,LEN(A1)-7,3,""),1,FIND(",",A1),""))+0

Try this version which should work for Italian settings - [I assume the data is in English as shown, e.g. months are January, February etc.]

=DATE(RIGHT(A1;4);SEARCH(MID(A1;FIND(",";A1)+2;3);"xxjanfebmaraprmayjunjulaugsepoctnovdec")/3;MID(A1;LEN(A1)-7;2))

这篇关于将字符串转换为Excel中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆