Jul 27 2024 02:40 PM - edited Jul 27 2024 03:10 PM
How do I get the result of an if statement into the cell where I've selected the python script to display the result?
I've so far used this script, it only displays in the diagnostic preview pane
a = xl("A1")
if a == xl("L1"):
print("That's a match")
I want to display this in cell A2
Jul 28 2024 10:16 AM - edited Jul 28 2024 10:18 AM
print only put information into the right message pane.
Into the grid last variable is returned. In your case it could be
Don't forget to return value, not object (see '123' ).
Since you have no else, if no match error will be returned
Jul 28 2024 02:44 PM
@SergeiBaklan I kind of know that, but I'm asking if there's a way to put the result into the cell I put the python code
Jul 29 2024 09:40 AM
If Python code is in cell A2 result of the code will be returned in A2, no other options.
Jul 30 2024 09:30 AM
Let me try again.
How do I get the result of an if statement into the cell where I've selected the python script to display the result
Python script is in cell A2, result shall be show in the same cell, correct?
Here is the starting point
I prefer Python editor
but for simple case we may continue in cell. Code is
Ctrl+Enter, we have Python object with result preview
To return the value select "123 Excel Value" from drop-down in formula bar
Actually the same was in first sample, but using editor.
Jul 30 2024 11:44 AM - edited Jul 30 2024 11:48 AM
Oh now I get you, thanks, now it works
I just needed the code that you gave as in
a = xl(....