Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Dear all,
I'm encountering an issue with my sheets. The expression in the red box is producing incorrect results based on the Δna criteria.
Could anyone help with this?
Thanks!
Solved! Go to Solution.
Thanks for the solution, i try to delete the "for" and use the "else if" and got the correct answer
In the equalities one side has m as unit other just has 0. Set the value to 0 m. for matching units in equalities.
hi, thanks for reply, but the results got the same wrong answer
Hi,
You need to use the if statements from the Math | Operators and Symbols | Programming | If statement .
Typing in the if statement does not work..
Can you post the sheet?
Maybe all you need to do is to omit the for-loop in your program. You seem to already have defined a range variable "i" in the worksheet.
BTW, is there any specific reason why you used "also if" instead of "else if" ?
I guess you should use "else if".
See the help for the difference between the two -> Conditional Operators
See if the attached example is of help.
knock me down with a feather you can use printed if statement in programming but you need to assign the result to something.
@terryhendicott wrote:
knock me down with a feather you can use printed if statement in programming but you need to assign the result to something.
Yes, but not necessarily in the "program" itself. Here your example without the assignment to the local variable c
The if-function is the last command executed in the program and so its result is the return value of the program.
In case of the expression in question the result of the if-functions used inside the programmed if-statement is assigned to the vector element sigmaip[i on the left hand side. Obviously he already defined a range variable "i" in the worksheet.
See the example in the file I attached in my last answer.
We could also use if-functions throughout, but I would strongly advise against doing so - especially given the much longer expression in the users work
All the user has to do is to delete the loop (which causes all the trouble) and replace the "also if" by an "else if" 😉
Thanks for the solution, i try to delete the "for" and use the "else if" and got the correct answer
Glad to see that it worked out for you.