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.

**Table of Contents**hide

**Download Practice Workbook**

You can download the workbook and practice with them.

**PI Function: Syntax and Arguments**

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

➧**Syntax**

The syntax for the PI function is:

**PI()**

➧**Arguments**

The **PI** **Function** syntax has no arguments.

**➧****Return Value**

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

**7 Examples of Pi Function in Excel**

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:

`=PI()*diameter`

**Read More:** **51 Mostly Used Math and Trig Functions in Excel**

**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:

`=PI()/4*radius^2`

**Read More:** **44 Mathematical Functions in Excel (Download Free PDF)**

**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:

`=4/3*PI()*radius^3`

**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:

`=number*PI()/180`

Is equivalent to:

`=number*180/PI()`

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

**Similar Readings**

**How to Use SIN Function in Excel (6 Easy Examples)****VBA EXP Function in Excel (5 Examples)****How to Use MMULT Function in Excel (6 Examples)****Use TRUNC Function in Excel (4 Examples)****How to Use TAN Function in Excel (6 Examples)**

**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:

`=2*PI()*sqrt(length/g)`

**Read More:** **How to Use SQRT function in Excel (6 Suitable Examples)**

**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:

`=DEGREES(PI())`

This formula returns **180.**

`=DEGREES(2*PI())`

And this formula returns **360.**

**7. Excel Pi in VBA**

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

`application.worksheetfunction.PI()`

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.**

**STEPS:**

- 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
```

- 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.

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.

**Conclusion**

Hope this will help you! If you have any questions, suggestions, or feedback please let us know in the comment section. Or you can have a glance at our other articles in the **ExcelDemy.com** blog!