How to Use Excel PI Function (7 Examples)

Get FREE Advanced Excel Exercises with Solutions!

In Microsoft Excel, the PI function returns the mathematical constant π (Pi). It is approximately equal to 3.1416. This article explains the PI function in excel.

PI Function: Syntax and Arguments

PI is the ratio of a circle’s circumference and its diameter.


The syntax for the PI function is:


PI Function: Syntax and Arguments


The PI Function syntax has no arguments.

Return Value

Returns the value of Pi, 3.14159265358979, accurate to 15 digits.

How to Use PI Function in Excel: 7 Useful Examples

If we want to use the value of Pi in a function or calculation, simply replace it with the function PI. Let’s look at a few simple examples to demonstrate how the PI function works.

1. Circumference of a Circle Using PI Function

Many arithmetic operations using the circle contain the constant π (Pi). The circumference of a circle is calculated using the formula 2πr. In the following example, column B contains the radius (r) and the diameter which is in column C is 2r. In column D, we can see the formula and the results are in column E.

Now, the formula for calculating the circumference of a circle using PI function is:


Circumference of a Circle Using PI Function 

2. Excel PI Function to Find the Area of a Circle

Another example, we can calculate the area of a circle using the PI function. For this, we just need the radius of a circle which is in column B. The mathematical formula for the area of a circle is πr^2. So, the excel formula will look like this:


3. The Volume of a Sphere

For calculating the volume of a sphere from the radius. We only need the radius for this calculation which is in column B. The mathematical formula for this is 4/3*πr^3. The formula for excel is:


The Volume of a Sphere Using PI Function in Excel

4. Degrees to Radians or Vice Versa

The PI function also can be used for changing from degrees to radians or vice versa. For this, we need numbers which we want to change. In the following example, the numbers are in column B. So, the formula will look like this:


Is equivalent to:


We can use any of those two formulas. In the picture below we use the first formula.

5. Period of a Pendulum

Likewise, to approximate the period of a pendulum we need g = 9.81, which we can see in column B. And also we need the length to calculate the period which is in column C. We can also see the formula and the results in columns D and E. In excel the formula for the period of a pendulum is:


Period of a Pendulum in Excel

6. Converting to Degrees

To convert an angle measured in radians, we can use the degree function to get the corresponding angle in degrees. For instance, the formula for converting the radians to degrees using the PI function is:


This formula returns 180.


And this formula returns 360.

Converting to Degrees Using PI Function

7. Excel Pi in VBA

Similarly, we can also use the PI function in VBA.


Enter the arguments for the function straight into the function or declare the variables to use instead. Alternatively, create a variable called “pi” and make it equal to the results of the worksheet function.

pi = Application.WorksheetFunction.Pi()

To insert the Pi value using VBA.


  • First, we need to select the cell.
  • Then, right-click on the worksheet.
  • Now, Go to View Code.

VBA Code:

Sub Pi()
Dim Pi As Single
Range("B5") = Application.WorksheetFunction.Pi()
Debug.Print Pi
End Sub

VBA in Excel

  • Next, copy and paste the VBA code into the window. Then, click on Run or use the keyboard shortcut (F5) to execute the macro code.
  • Finally, the selected cell now has the pi value.

Excel Pi Name Error

There is not much that can go wrong with the PI function, except the #NAME? error. If we get a #NAME? error while trying to utilize Pi in an Excel calculation, it’s by reason we failed to include the opening as well as the closing parenthesis.

Pi Name Error in Excel

Remember that Pi is an excel function, and although it doesn’t take any parameters. It must be entered with parentheses for excel to identify it as such.

Pi Name Error in Excel

Download Practice Workbook

You can download the workbook and practice with them.


Hope this will help you! If you have any questions, suggestions, or feedback please let us know in the comment section.


What is ExcelDemy?

ExcelDemy Learn Excel & Excel Solutions Center provides free Excel tutorials, free support , online Excel training and Excel consultancy services for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Sabrina Ayon
Sabrina Ayon

Hi there! This is Sabrina Ayon. I'm really excited to welcome you to my profile. Currently, I'm working in SOFTEKO as a Team Leader. I'm a graduate in BSc in Computer Science and Engineering from United International University. I love working with computers and solving problems. I’ve always been interested in research and development. Here I post articles related to Microsoft Excel. Hoped this may help you. Thank you.

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF