PI Function Examples – Excel, VBA, & Google Sheets
Written by
Reviewed by
Download the example workbook
This tutorial demonstrates how to use the PI Function in Excel to return the value of PI.
PI Function OVERVIEW
The PI function returns the value of π , 3.14159265358979, accurate to 15 digits.
To use the PI Excel Worksheet Function, select a cell and type:
=PI()
Decimal places
When using the PI function, Excel stores the value to 15 decimal places. To show more or less decimal places, use the Increase Decimal or Decrease Decimal buttons in the Home menu.
Note: Because π is only calculated to 15 decimal places, exact values for trigonometric functions are not always returned.
Converting to degrees
To convert the value of π to degrees, use PI along with the DEGREES function.
=DEGREES(PI())
Common Errors
When calculating scalar multiples of π , the operation symbol (like multiply or divide) is necessary. Without it, the following error is displayed.
PI in Google Sheets
The PI Function works exactly the same in Google Sheets as in Excel:
PI Examples in VBA
You can also use the PI function in VBA. Type:
application.worksheetfunction.pi()
Executing the following VBA statement
Range("A1") = Application.WorksheetFunction.Pi()
will produce the following result
For more information about the PI Formula visit the
Microsoft Website.