Forum Discussion
Convert multiple combinations of date text strings into a seconds
- Aug 04, 2018
Another way could be with using of EVALUATE
Let define in Name Manager new name, let say TransformToSeconds, with value
=EVALUATE("="&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"s",""),"m","*60+"),"h","*60*60+"),"d","*24*60*60+"))
SUBSTITUTE here transforms text string into the text like (for the first value)
2*24*60*60+19*60*60+20*60+55
and with EVALUATE we calculate that formula
After that in next to the source string we put the formula
=TransformToSeconds
which returns the result.
The only point workbook with EVALUATE shall be saved as macro-enabled one (*.xlsm). Attached.
Another way could be with using of EVALUATE
Let define in Name Manager new name, let say TransformToSeconds, with value
=EVALUATE("="&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A2,"s",""),"m","*60+"),"h","*60*60+"),"d","*24*60*60+"))
SUBSTITUTE here transforms text string into the text like (for the first value)
2*24*60*60+19*60*60+20*60+55
and with EVALUATE we calculate that formula
After that in next to the source string we put the formula
=TransformToSeconds
which returns the result.
The only point workbook with EVALUATE shall be saved as macro-enabled one (*.xlsm). Attached.