Convert 'yyyymmdd hhmmss' to 'mm/dd/yy hh:mm'

前端 未结 3 589
眼角桃花
眼角桃花 2021-01-22 02:33

I have a row of data (Cell A3 and down) that contains a Unix timestamp in yyyymmdd hhmmss format that I\'m trying to convert to mm/dd/yy hh:mm format <

3条回答
  •  鱼传尺愫
    2021-01-22 02:57

    This will do it with no looping at all:

    Sub kyle()
        With [a3].Resize([a1048576].End(xlUp).Row - 2)
            .Value = Evaluate("transpose(transpose(DATE(MID(" & .Address & ",1,4),MID(" & .Address & ",5,2),MID(" & .Address & ",7,2)) + TIME(MID(" & .Address & ",10,2),MID(" & .Address & ",12,2),MID(" & .Address & ",14,2))))")
        End With
    End Sub
    

    Note: you can then use whatever number formatting for the dates you please.

提交回复
热议问题