golfinhu Posted April 17, 2018 Share Posted April 17, 2018 Hi, people, how are you? I'm trying to create an algorithm that passes conditional formulas from excel to Autoit, I was thinking of doing something recursive, but I'm not getting it. #include <Array.au3> $sString = '=IF(D15="NO",(-K6+(K6*K6-4*K5*K7)^(1/2))/(2*K5),IF(G9="BIG",G14,(-K6+(K6*K6-4*K5*K7)^(1/2))/(2*K5)))' MsgBox(0,'', _a($sString)) Func _a($sString) MsgBox(0, '', $sString) Local $sCondition = StringRegExp($sString, "IF\((.+?);", 3)[0] Local $aRight = StringRegExp($sString, "IF\(.+?;(.+)\)", 3) If StringLeft($aRight[0], 2) <> "IF" Then Return 0 Else Return _a($aRight[0]) EndIf EndFunc I wanted something like this: if $D15 = "NO" then (-$K6+($K6*$K6-4*$K5*$K7)^(1/2))/(2*$K5); elseif $G9 = 'BIG' then $G14 else (-$K6+($K6*$K6-4*$K5*$K7^(1/2/(2*$K5)))); Endif Remembering that you can have IF inside IF. Is there any simple way to do this? Thank you very much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now