HomePI Function in Google Sheets And Other Fun π FactsFormulas & FunctionsPI Function in Google Sheets And Other Fun π Facts

PI Function in Google Sheets And Other Fun π Facts

Mastering the PI Function in Google Sheets is essential whenever you need to run accurate geometry calculations, engineering formulas, or mathematical models without manually typing rounded decimals. Built directly into Google Sheets, PI() returns the mathematical constant pi ($\pi$)—defined as the ratio of a circle’s circumference to its diameter—accurate to 9 decimal places (3.141592654). Beyond basic circle measurements, you can pair the PI Function with CHAR, SEQUENCE, and even Google Apps Script to render Unicode symbols, approximate infinite mathematical series, and fetch thousands of digits of $\pi$ right inside your spreadsheet.

Pi is denoted by the Greek lowercase letter π

PI Function in Google Sheets: Syntax

=PI()

There are no arguments. If you put anything between the brackets the formula will give you an error.

Circle Calculations With The PI Function

If you know the circumference of a circle then you can calculate the diameter and vice versa.

How to calculate the circumference

Suppose you have a diameter of 10 (the units are irrelevant).

Then you calculate the circumference with this formula: the diameter multiplied by pi.

= 10 * PI()

How to calculate the diameter

Now suppose you know the circumference is value 10.

The diameter is calculated as the circumference divided by pi:

= 10 / PI()

How to calculate the area of a circle

The formula for the area of a circle is π * r² (pi times the radius squared).

To calculate the radius, you must divide the diameter by 2.

So, knowing the diameter d, you can calculate the area of a circle as follows: π * (d/2)²

Taking a diameter of 10, the area is:

= PI() * ( 10 / 2 )^2

for an answer 78.5398

Creating the PI Symbol with the CHAR Function

If you want to display the Greek lowercase symbol $\pi$ cleanly in headers or labels without copying and pasting special characters, pass its Unicode decimal code (960) into the CHAR function:

=CHAR(960)

Setting the cell to the Merriweather font gives it the nice rounded appearance shown in this image:

Pi Symbol With Char Function

By the way, this formula:

=CHAR(129383)

will output an image of an entirely different type of pie in your Google Sheet:

Pie in a Google Sheet

Approximating Pi in Google Sheets With the Nilakantha Series

The Nilakantha series, named after the 15th century mathematician of the same name, is an infinite series that converges on pi as the number of iterations rises. It converges quickly so it’s a good algorithm to use to compute the digits of pi.

The Nilakantha series is:

Nilakantha Series
Image source: Wikipedia

Let’s build an approximation of pi in a Google Sheet using this series.

Nilakantha Series in Google Sheets With The PI Function

In cell A1, enter this formula with the SEQUENCE function:

=SEQUENCE(1000,1,2,2)

And in B1:

=SEQUENCE(1000,1,3,2)

Then in C1:

=SEQUENCE(1000,1,4,2)

These three formulas give us three columns of numbers with 1,000 digits each. They start with 2, 3 and 4 respectively and increment by 2.

Look closely at the infinite series definition above and you’ll notice that each row represents a denominator for each iteration of the series.

In cell D1, multiply the values together for each row:

=PRODUCT(A1:C1)

Copy this formula down the column.

This formula generates the denominators for the series.

In cell E1, put this product as the denominator to calculate the series values:

= 4 / D1

Next, we need to alternate adding and subtracting these values, which we can do with this formula:

=IF( ISODD( ROW() ), E1 , UMINUS( E1 ) )

This IF formula checks if we’re on an odd numbered row (e.g. row 1) using the ISODD function and, if we are, returns the number unchanged. But if we’re on an even numbered row, it returns the negative value from column E, using the UMINUS function.

Finally, we can approximate pi in column G.

In G1, put this formula to start the series:

= 3 + F1

In cell G2, put this formula:

= G1 + F2

and drag this formula all the way to the bottom of the range.

With 1,000 rows, we get a value for pi of 3.1415926533, which is a similar level of accuracy to the PI function.

Here are the first 16 iterations, the remaining rows up to 1,000 can be found in the template linked above in this article:

Nilakantha Series to approximate pi in Google Sheets

Now, you might be wondering how many digits of pi have been calculated…

Obviously, that is not a calculation you can perform in your Google Sheet, but interestingly, it was performed on Google Cloud infrastructure!

Update: The record is now 50 trillion digits, broken by an enthusiast with a self-built server setup. Super impressive!

Also Read : How To Create A Heat Map In Google Sheets

One thought on “PI Function in Google Sheets And Other Fun π Facts”

Leave a Reply

Your email address will not be published. Required fields are marked *