• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Equation in text format convert to value

madocar

Member
Is there a way to convert string (equation) to equation able to be calculate.

Original format (column A):

22 y 180 d 5 h

Required format

8210,208333 (days)

Substitute formula helps a lot (column B).

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A9;" y ";"*365+");" d ";"+");" h";"/24")

But I'm still unable to convert equation in text to value.
More in attachment

Thanks for any help
 

Attachments

Personally, I'd just split column using Text To Columns and do calculation.

@NARAYANK991
Neat way to leverage Evaluate. I've got to remember this one.

@madocar
If for some reason you are not able to use macro enabled workbook...
=IFERROR(LEFT(A9,FIND("@",SUBSTITUTE(A9,"y","@",1))-1),0)*365+MID(A9,FIND("@",SUBSTITUTE(A9,"d","@"))-4,3)+MID(A9,FIND("d",A9)+2,FIND("h",A9)-FIND("d",A9)-2)/24
 
Back
Top