Parsing string in Excel - date and time -


i have following problem:

i want extract time interval string

time=10pm-12am!991408111200000

the problem is, need in 24hrs format, 10pm-12am should 22 , 00 in 2 different cells. tried several solutions, nothing worked possible intervals. have idea how can that? lot!

this should work. assume original string on a1. first code first portion of time. second time after dash.

=text(iferror(replace(mid(a1,find("=",a1)+1,find("-",a1)-1-find("=",a1)),find("pm",mid(a1,find("=",a1)+1,find("-",a1)-1-find("=",a1))),2," pm"),replace(mid(a1,find("=",a1)+1,find("-",a1)-1-find("=",a1)),find("am",mid(a1,find("=",a1)+1,find("-",a1)-1-find("=",a1))),2," am")),"hh:mm")  =text(iferror(replace(mid(a1,find("-",a1)+1,find("m",a1,find("-",a1))-find("-",a1)),find("pm",mid(a1,find("-",a1)+1,find("m",a1,find("-",a1))-find("-",a1))),2," pm"),replace(mid(a1,find("-",a1)+1,find("m",a1,find("-",a1))-find("-",a1)),find("am",mid(a1,find("-",a1)+1,find("m",a1,find("-",a1))-find("-",a1))),2," am")),"hh:mm") 

the reason long because not sure if data comes 4 characters time. example, if data has time=3pm-6pm should smart enough understand there less spaces in between. assumes exclamation mark happened randomly there rather there.

let me know if have problem.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -