Excel DATEVALUE function independent of international settings

断了今生、忘了曾经 提交于 2019-12-06 04:22:00

You can try this formula:

=DATE(RIGHT(A1;4);MATCH(MID(A1;4;3);{"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"};0);LEFT(A1;2))

Date admits arguments always in the order year, month, day

I admit that day values are always 2 digits.

If you dont mind to write the months abrev. in a range then you can get a much more shorter formula.

Depending on your regional settings you may need to replace field separator ";" by ","

Try the following UDF :

Public Function EngDate(s As String) As Date
    Dim dayz As Long, monthz As Long, yearz As Long
    ary = Split(LCase(s), " ")
    dayz = CLng(ary(0))
    yearz = CLng(ary(2))
    mnth = Split("january,february,march,april,may,june,july august,september,october,november,december", ",")
    For i = 0 To 11
        If ary(1) = mnth(i) Then
            monthz = CLng(i + 1)
            Exit For
        End If
    Next i
    EngDate = DateSerial(yearz, monthz, dayz)
End Function

It will process inputs like:

day as number, single space, month as text, single space, year as a number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!