I have to convert some formatted text to excel time, but I could not find a solution by myself.
Here are some examples of the input text and how it should be converted:
- 1 Hour 14 minutes ==> 01:14:00
- 1 minute. ==> 00:01:00
- 1 Hour 1 minute ==> 01:01:00
- 2 minutes ==> 00:02:00
- 3 minutes 12 seconds ==> 00:03:12
- 29 seconds ==> 00:00:29
Observe that some times there are both minutes and seconds and some others only one of minutes/seconds, besides some times you find minutes (plural) and some others just minute (singular). Finally, some punctuation signs could be in the text some times.
The data is in a spreadsheet column and I want to extract the excel formatted time in a different column on the spreadsheet.
I've tried different versions of TimeValue()
and DateValue()
and some nested replace() all of them in a cell formula, but none of them worked for all cases.
Could you give me an idea or some advice on how to approach this problem?
Thanks,
Paul
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…