PY
Type =PY and select it from autocomplete to open the Python editor. Excel generates the underlying function when you run the code.
Syntax
=PY(python_code, return_type)Microsoft documentation
Check the arguments, supported editions and behavior of this function in Microsoft’s reference.
Microsoft referencePython in Excel Tutorial for Beginners (=PY, pandas, Charts)
Practice PY
In Excel’s Python editor, the expression 2 + 3 can return an Excel value. Practice the underlying PY call using the code text "2 + 3" and return type 0.
Show example formula
=PY("2 + 3",0) Lesson quiz
Answer three questions to see your level in this lesson.
